Skip to content

Commit

Permalink
feat: make release based on commit mesage
Browse files Browse the repository at this point in the history
  • Loading branch information
pbogut committed Oct 4, 2023
1 parent 1d8a39b commit 37c2fdd
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,10 @@ jobs:
- name: Check if release should be created
shell: bash
run: |
RELEASE_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' Cargo.toml)
OLD_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' <<< "$(git show HEAD~1:Cargo.toml)")
if [[ "$RELEASE_VERSION" == "$OLD_VERSION" ]]; then
echo "SHOULD_RELEASE=no" >> $GITHUB_ENV
else
if [[ $(git log -1 --pretty=%B) =~ ^release: ]]; then
echo "SHOULD_RELEASE=yes" >> $GITHUB_ENV
else
echo "SHOULD_RELEASE=no" >> $GITHUB_ENV
fi
- name: Build vscode extension
Expand Down Expand Up @@ -131,17 +129,14 @@ jobs:
shell: bash
run: |
RELEASE_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' Cargo.toml)
OLD_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' <<< "$(git show HEAD~1:Cargo.toml)")
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
echo "$OLD_VERSION -> $RELEASE_VERSION"
if [[ "$RELEASE_VERSION" == "$OLD_VERSION" ]]; then
echo "SHOULD_RELEASE=no" >> $GITHUB_ENV
else
if [[ $(git log -1 --pretty=%B) =~ ^release: ]]; then
git tag "$RELEASE_VERSION"
git push -u origin "$RELEASE_VERSION"
echo "SHOULD_RELEASE=yes" >> $GITHUB_ENV
else
git tag --force "latest@dev"
git push --force -u origin "latest@dev"
echo "SHOULD_RELEASE=no" >> $GITHUB_ENV
fi
- name: Publish release
Expand All @@ -160,6 +155,7 @@ jobs:
if: env.SHOULD_RELEASE == 'no'
with:
files: dist/*
tag_name: latest@dev
fail_on_unmatched_files: true
generate_release_notes: false
prerelease: true
Expand Down

0 comments on commit 37c2fdd

Please sign in to comment.