Skip to content

The version check requires a new version only when the published library changes - #38

Merged
augustak merged 1 commit into
masterfrom
version-check-library-changes
Dec 2, 2026
Merged

augustak merged 1 commit into
masterfrom
version-check-library-changes

Conversation

@augustak

@augustak augustak commented Dec 2, 2026

Copy link
Copy Markdown
Member

The version check failed every PR that didn't change the version, including ones that only touch docs, tests or CI, such as #37. The rule that matters is that a released version can't change. So the check now:

  1. Passes if the PR doesn't change src/main/ or build.gradle, the files that make up the published library.
  2. Otherwise, looks up the version in gradle.properties on Maven Central. It fails if that version is already released, and passes if it isn't, so several PRs can go into one unreleased version.

The job keeps the name CheckVersionAndReleaseNote in case branch protection requires it by name. The old check also only worked by accident: its [ -z $(...)] was missing a space before ].

Testing

I ran the check's script against simulated PR merge commits:

PR changes Version Result
README.md 4.0.1 pass, library unchanged
a test 4.0.1 pass, library unchanged
Client.java 4.0.1 (not released) pass
build.gradle 4.0.1 (not released) pass
Client.java 4.0.0 (released) fail, with an error on gradle.properties

Relation to other PRs

#37 changes build.gradle while the version is the unreleased 4.0.1, so its check passes once this is merged and #37 is updated from master. Re-running its check isn't enough, because a re-run uses the workflow from #37's existing merge commit.

🤖 Generated with Claude Code

…ary changes

Every PR had to change the version, even ones that only touch docs, tests or
CI. A released version can't change, so the check now fails only when
src/main or build.gradle changes while the version in gradle.properties is
already on Maven Central. Several PRs can go into one unreleased version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@augustak
augustak merged commit 9ae4629 into master Dec 2, 2026
2 checks passed
@augustak
augustak deleted the version-check-library-changes branch December 2, 2026 14:58
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