fix: do not fail the release when pyproject.toml is already current #18

Merged
lyrathorpe merged 1 commits from fix/release-commit-guard into main 2026-08-21 14:50:09 +01:00
Owner

The defect

The release step added in #17 commits the computed version unconditionally:

git add pyproject.toml
git commit -m "chore(release): v${VERSION}"

If pyproject.toml already carries that version — a re-run of a release, or a version corrected by hand — nothing is staged, git commit exits non-zero, and set -euo pipefail fails the job. By that point the image has already been pushed, so the release is half-done: published container, no tag. The next run then computes the same version again from the same commits.

The fix

Skip the commit and its branch push when there is nothing staged; tag either way.

Verification

The step was extracted from the workflow and run against a scratch repository with a real origin:

  • VERSION equal to the file's version → logs pyproject.toml is already at 0.1.0, pushes the tag, no commit.
  • VERSION different → commits chore(release): v0.2.0, pushes the branch, then the tag.

Both paths leave main and the tags consistent. bash -n clean.

Found while porting this same release scheme to music-mirror, which carries the guarded version from the start.

## The defect The release step added in #17 commits the computed version unconditionally: ```sh git add pyproject.toml git commit -m "chore(release): v${VERSION}" ``` If `pyproject.toml` already carries that version — a re-run of a release, or a version corrected by hand — nothing is staged, `git commit` exits non-zero, and `set -euo pipefail` fails the job. By that point the image has already been pushed, so the release is half-done: published container, no tag. The next run then computes the same version again from the same commits. ## The fix Skip the commit and its branch push when there is nothing staged; tag either way. ## Verification The step was extracted from the workflow and run against a scratch repository with a real `origin`: - `VERSION` equal to the file's version → logs `pyproject.toml is already at 0.1.0`, pushes the tag, no commit. - `VERSION` different → commits `chore(release): v0.2.0`, pushes the branch, then the tag. Both paths leave `main` and the tags consistent. `bash -n` clean. Found while porting this same release scheme to `music-mirror`, which carries the guarded version from the start.
lyrathorpe added 1 commit 2026-08-21 14:47:21 +01:00
fix: do not fail the release when pyproject.toml is already current
Build and publish container / build (pull_request) Successful in 12m18s
9c2140b832
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>
lyrathorpe merged commit efa76ce17b into main 2026-08-21 14:50:09 +01:00
lyrathorpe deleted branch fix/release-commit-guard 2026-08-21 14:50:11 +01:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lyrathorpe/legacy-email-proxy#18