Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,20 @@ jobs:
run: |
CURRENT_VERSION=$(cat VERSION)
PREVIOUS_VERSION=$(git show HEAD~1:VERSION 2>/dev/null || echo "")
if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then
echo "version_changed=true" >> "$GITHUB_OUTPUT"
echo "new_version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT"
else
echo "version_changed=false" >> "$GITHUB_OUTPUT"
fi
if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then
echo "version_changed=true" >> "$GITHUB_OUTPUT"
echo "new_version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT"
else
echo "version_changed=false" >> "$GITHUB_OUTPUT"
fi
- name: create release
if: steps.version_check.outputs.version_changed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ steps.version_check.outputs.new_version }}"
if gh release view "v${VERSION}" >/dev/null 2>&1; then

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This guard keeps the release workflow idempotent. It matters after a release rerun or a main-history repair because the version can still look changed while the GitHub release/tag already exists; in that case the workflow should report the existing release and exit successfully instead of failing with a 422 from gh release create.

echo "Release v${VERSION} already exists"
exit 0
fi
gh release create "v${VERSION}" --title "v${VERSION}" --notes "Release ${VERSION}"
Loading