Skip to content

ci: Fail a release whose tag doesn't match the pom version - #142

Merged
robgordon89 merged 1 commit into
mainfrom
fix/release-tag-check
Sep 30, 2026
Merged

robgordon89 merged 1 commit into
mainfrom
fix/release-tag-check

Conversation

@robgordon89

Copy link
Copy Markdown
Contributor

Why?

The first v2.4.0 publish run built the pom's version, 2.3.0, because the tag was cut before the version bump. Signing was also broken, so nothing shipped. Had it worked, the v2.4.0 code would have gone to Maven Central as 2.3.0, and Central releases can't be deleted. This check stops that kind of run before anything is built.

Changes

  1. publish.yaml: a new step before Publish to Apache Maven Central reads the pom version with mvn help:evaluate and fails the job if the release tag doesn't match. A leading v on the tag is optional: v2.5.0 and 2.5.0 both match 2.5.0. The step only runs on release events, so a manual run behaves as before. It's the same step as in Fix Maven Central publishing and sync build with mailersend-java mailerlite/mailerlite-java#18.

Risks

Low risk. The comparison was tested locally with matching and mismatched tag/version pairs, but the mvn help:evaluate line first runs on the next release. If it misbehaves, the job fails before mvn deploy, so nothing gets uploaded. Fix it and re-run.

Performance impact

One extra Maven call per release, a few seconds.

Security impact

No security impact. The tag is read from the GITHUB_REF_NAME environment variable rather than through ${{ }} interpolation, so a tag name can't inject shell commands.

How to QA

There's nothing to QA before the next release. The Build check on this PR doesn't run this workflow. On the next release, check that Check release tag matches pom version passed in the Maven Publish run before Publish to Apache Maven Central.

SDK code and tests are unchanged and don't need QA.

How to release

Merge. The check applies from the next GitHub release, so bump the pom version before publishing it.

Rollback strategy

  • Migrations: none.
  • Data changes: none.
  • External dependencies: none new. maven-help-plugin is resolved from Central when the step runs.
  • Config: revert this PR.

Screenshots, recordings

N/A

I used AI to generate parts of this PR

Yes

🤖 Generated with Claude Code

The first v2.4.0 run built the pom's 2.3.0. Signing was also broken,
so nothing shipped. Had it worked, the v2.4.0 code would have gone to
Central as 2.3.0, and Central releases can't be deleted.

The check only runs on release events, so a manual run still publishes
whatever version the pom has. A leading v on the tag is optional. Same
step as mailerlite/mailerlite-java#18.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@robgordon89 robgordon89 self-assigned this Sep 30, 2026
@robgordon89
robgordon89 marked this pull request as ready for review September 30, 2026 11:04
@robgordon89
robgordon89 merged commit 91c31ba into main Sep 30, 2026
3 checks passed
@robgordon89
robgordon89 deleted the fix/release-tag-check branch September 30, 2026 11:04
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