Skip to content

Commit

Permalink
fix(workflow): correct version check logic in release workflow
Browse files Browse the repository at this point in the history
Refactored the version check logic to handle both workflow dispatch and push events correctly. Ensured previous version is checked only when necessary.
  • Loading branch information
thelezend committed Sep 15, 2024
1 parent 72b86be commit d861b58
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@ jobs:
- name: Check if version changed
id: version_check
run: |
PREV_VERSION=$(git show HEAD~1:Cargo.toml | grep '^version =' | awk -F\" '{print $2}')
CURR_VERSION=$(grep '^version =' Cargo.toml | awk -F\" '{print $2}')
echo "Previous version: $PREV_VERSION"
echo "Current version: $CURR_VERSION"
echo "version=$CURR_VERSION" >> $GITHUB_OUTPUT
if [ "$PREV_VERSION" != "$CURR_VERSION" ]; then
if [ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]; then
echo "version_changed=true" >> $GITHUB_OUTPUT
else
echo "version_changed=false" >> $GITHUB_OUTPUT
PREV_VERSION=$(git show HEAD~1:Cargo.toml | grep '^version =' | awk -F\" '{print $2}')
echo "Previous version: $PREV_VERSION"
if [ "$PREV_VERSION" != "$CURR_VERSION" ]; then
echo "version_changed=true" >> $GITHUB_OUTPUT
else
echo "version_changed=false" >> $GITHUB_OUTPUT
fi
fi
build:
Expand Down

0 comments on commit d861b58

Please sign in to comment.