fix: do not fail the release when pyproject.toml is already current
Build and publish container / build (pull_request) Successful in 12m18s
Build and publish container / build (pull_request) Successful in 12m18s
The release step added in #17 commits the computed version unconditionally. If pyproject.toml already carries that version -- a re-run of a release, or a version corrected by hand -- there is nothing staged and `git commit` exits non-zero, failing the job after the image has already been pushed and before the tag is created. Skip the commit and its push in that case, and tag either way. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
e2ec48f1db
commit
9c2140b832
@@ -188,11 +188,19 @@ jobs:
|
|||||||
git config user.name "${{ github.actor }}"
|
git config user.name "${{ github.actor }}"
|
||||||
git config user.email "${{ github.actor }}@users.noreply.${REGISTRY}"
|
git config user.email "${{ github.actor }}@users.noreply.${REGISTRY}"
|
||||||
git add pyproject.toml
|
git add pyproject.toml
|
||||||
git commit -m "chore(release): v${VERSION}"
|
|
||||||
|
|
||||||
|
# The file may already carry this version, in which case there is
|
||||||
|
# nothing to commit and `git commit` would fail the job after the
|
||||||
|
# image has already been pushed.
|
||||||
|
if git diff --cached --quiet; then
|
||||||
|
echo "pyproject.toml is already at ${VERSION}"
|
||||||
|
else
|
||||||
|
git commit -m "chore(release): v${VERSION}"
|
||||||
# Push the branch before the tag. If main has moved on and this push
|
# Push the branch before the tag. If main has moved on and this push
|
||||||
# is rejected, the job fails without having left a tag pointing at a
|
# is rejected, the job fails without having left a tag pointing at a
|
||||||
# commit that is not on main.
|
# commit that is not on main.
|
||||||
git push origin "HEAD:${GITHUB_REF_NAME}"
|
git push origin "HEAD:${GITHUB_REF_NAME}"
|
||||||
|
fi
|
||||||
|
|
||||||
git tag -a "v${VERSION}" -m "v${VERSION}"
|
git tag -a "v${VERSION}" -m "v${VERSION}"
|
||||||
git push origin "v${VERSION}"
|
git push origin "v${VERSION}"
|
||||||
|
|||||||
Reference in New Issue
Block a user