diff --git a/.gitea/workflows/build-and-publish.yaml b/.gitea/workflows/build-and-publish.yaml index c40b899..19570a0 100644 --- a/.gitea/workflows/build-and-publish.yaml +++ b/.gitea/workflows/build-and-publish.yaml @@ -188,11 +188,19 @@ jobs: git config user.name "${{ github.actor }}" git config user.email "${{ github.actor }}@users.noreply.${REGISTRY}" git add pyproject.toml - git commit -m "chore(release): v${VERSION}" - # 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 - # commit that is not on main. - git push origin "HEAD:${GITHUB_REF_NAME}" + # 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 + # is rejected, the job fails without having left a tag pointing at a + # commit that is not on main. + git push origin "HEAD:${GITHUB_REF_NAME}" + fi + git tag -a "v${VERSION}" -m "v${VERSION}" git push origin "v${VERSION}"