Skip to content

Tag before publishing again, and roll the tag back on failure - #191

Merged
andreashasse merged 1 commit into
mainfrom
andreashasse/release-tag-rollback
Sep 11, 2026
Merged

andreashasse merged 1 commit into
mainfrom
andreashasse/release-tag-rollback

Conversation

@andreashasse

Copy link
Copy Markdown
Owner

Follow-up to #190, which fixed the missing rebar3_hex plugin but broke releases a different way:

===> Failed to publish package spectra - 0.13.4+build.429.ref3e72b46 : Validation error(s)
        version: build number not allowed

Why

src/spectra.app.src declares {vsn, "git"}, so rebar3 derives the package version from git describe. PR #190 moved git tag to after rebar3 hex publish to avoid leaving a stray tag behind on failure, but that meant no tag pointed at HEAD when the version was resolved. git describe then produced a build-number suffix, which Hex rejects.

What changed

Tag before rebar3 compile again so the version resolves cleanly, but wrap the compile/build/publish steps in an if and delete the local tag when they fail. That keeps the stray-tag problem fixed. The tag now survives only once publishing succeeded, which is also before anything has been pushed, so the rollback never has to undo a remote change.

Testing

Verified the recipe is valid shell with sh -n, and exercised the failure path in a scratch repository: the tag is created, publish fails, the tag is deleted, and the target exits non-zero.

🤖 Generated with Claude Code

Moving `git tag` after `rebar3 hex publish` broke releases a different
way: `spectra.app.src` uses `{vsn, "git"}`, so rebar3 derives the
version from `git describe`. With no tag on HEAD that produced
`0.13.4+build.429.ref3e72b46`, which Hex rejects with "build number not
allowed".

Tag before compiling again so the version resolves, but wrap the
publish steps so a failure deletes the local tag. That keeps the
original problem fixed: no stray tag blocking the retry. The tag is
only kept once publishing succeeded, which is also the point before
anything has been pushed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@andreashasse
andreashasse merged commit a5262df into main Sep 11, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant