Add release script and workflow to check release versions - #136
Merged
Merged
Conversation
The 3.0.2 bump commit was tagged and released but never merged into trunk. release.sh refuses to release unless trunk matches origin/trunk and getVersion() matches the new version, then creates the tag and GitHub release. The Release check workflow fails if a release tag is not on trunk or does not match getVersion(), catching manual releases. Document the process in a new Releasing section of the README.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The 3.0.2 version bump commit was tagged and released, but it was never merged into
trunk, sotrunkstill reported3.0.1. This adds a check before releasing and a backstop check afterward so that can't happen unnoticed again.What
release.sh <version>(--dry-runruns only the checks). It refuses to release unless:trunkwith no uncommitted changes to tracked filestrunkmatchesorigin/trunk, so the release commit is already on the remotegetVersion()inPhpcsChanged/functions.phpreturns exactly<version>v<version>doesn't already exist and is higher than the latest release tagIt then runs
gh release create v<version> --target <origin/trunk sha> --generate-notes, which creates a lightweight tag and generated release notes, like past releases.Release check workflow (
.github/workflows/release-check.yml). It runs onv*tag pushes and on published releases, and fails if the tagged commit isn't ontrunkor if itsgetVersion()doesn't match the tag. It can't block a release, but it flags releases made by hand.README: a new "Releasing" section at the bottom documents the process, including when to use a minor or a patch bump.
Testing
./release.sh --dry-runagainst a cleantrunk:3.1.0passes all checks3.2.0,3.0.2and3.0.9fail thegetVersion()check3.1fails the version format checkorigin/trunkcheckv3.1.0fails the tag-exists check, and av3.5.0fails the higher-than-latest-tag check.v3.0.2fails the on-trunk check, which it would have caught.v3.0.1passes both checks.