Skip to content

Commit b42593c

Browse files
committed
release: v0.1.0-rc #999
1 parent da5a8c3 commit b42593c

File tree

2 files changed

+25
-14
lines changed

2 files changed

+25
-14
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- synchronize
99
- reopened
1010
branches:
11+
- main
1112
- develop
1213

1314
env:

.github/workflows/deploy.yml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Deploy
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [main, develop]
66

77
permissions:
88
contents: write
@@ -17,13 +17,18 @@ jobs:
1717

1818
- name: Apply version
1919
run: |
20-
version=$(git log --pretty=format:%s -n 1 | awk -F' ' '{print $2}')
20+
rg='^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$'
21+
commit=$(git log --pretty=format:%s -n 1)
22+
version=$(echo "$commit" | sed -E 's/^release: ?//; s/v([0-9a-zA-Z.-]+)( #[0-9]+)?/\1/; s/ #[0-9]+//')
23+
24+
if [[ $version =~ $rg ]]; then
25+
is_latest=$([[ -z "${BASH_REMATCH[5]:-}" ]] && echo "yes" || echo "no")
2126
22-
if [[ "$version" =~ ^v[0-9]+(\.[0-9]+){2}$ ]]; then
2327
echo "APP_VERSION=$version" >> $GITHUB_ENV
28+
echo "APP_VERSION_IS_LATEST=$is_latest" >> $GITHUB_ENV
2429
else
25-
echo "Parsed version: $version"
26-
echo "Commit message: $(git log --pretty=format:%s -n 1)"
30+
echo "Parsed version: '$version'"
31+
echo "Commit message: '$commit'"
2732
exit 1
2833
fi
2934
@@ -37,9 +42,9 @@ jobs:
3742
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3843
run: |
3944
gh release create $APP_VERSION \
40-
--title "$APP_VERSION" \
41-
--notes "Please refer to the [documentation](https://bidaro-open-source.github.io/changelog/)." \
42-
--latest
45+
--title "$APP_VERSION" \
46+
--notes "Please refer to the [documentation](https://bidaro-open-source.github.io/changelog/)." \
47+
$([[ "$APP_VERSION_IS_LATEST" == "yes" ]] && echo "--latest" || echo "--latest=false")
4348
4449
release-docker:
4550
name: Create docker release
@@ -50,13 +55,18 @@ jobs:
5055

5156
- name: Apply version
5257
run: |
53-
version=$(git log --pretty=format:%s -n 1 | awk -F' ' '{print $2}')
58+
rg='^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$'
59+
commit=$(git log --pretty=format:%s -n 1)
60+
version=$(echo "$commit" | sed -E 's/^release: ?//; s/v([0-9a-zA-Z.-]+)( #[0-9]+)?/\1/; s/ #[0-9]+//')
61+
62+
if [[ $version =~ $rg ]]; then
63+
is_latest=$([[ -z "${BASH_REMATCH[5]:-}" ]] && echo "yes" || echo "no")
5464
55-
if [[ "$version" =~ ^v[0-9]+(\.[0-9]+){2}$ ]]; then
5665
echo "APP_VERSION=$version" >> $GITHUB_ENV
66+
echo "APP_VERSION_IS_LATEST=$is_latest" >> $GITHUB_ENV
5767
else
58-
echo "Parsed version: $version"
59-
echo "Commit message: $(git log --pretty=format:%s -n 1)"
68+
echo "Parsed version: '$version'"
69+
echo "Commit message: '$commit'"
6070
exit 1
6171
fi
6272
@@ -78,5 +88,5 @@ jobs:
7888
context: .
7989
push: true
8090
tags: |
81-
${{ secrets.DOCKERHUB_USERNAME }}/bidaro-migrator:latest
82-
${{ secrets.DOCKERHUB_USERNAME }}/bidaro-migrator:${{ env.APP_VERSION }}
91+
${{ format('{0}/{1}:{2}', secrets.DOCKERHUB_USERNAME, secrets.DOCKERHUB_REPOSITORY, env.APP_VERSION) }}
92+
${{ env.APP_VERSION_IS_LATEST == 'yes' && format('{0}/{1}:latest', secrets.DOCKERHUB_USERNAME, secrets.DOCKERHUB_REPOSITORY) || null }}

0 commit comments

Comments
 (0)