Repository navigation
Release automatically when the version changes - #25
Merged
Merged
Conversation
Add a release job to the CI workflow that runs on pushes to the default branch after the test and static-analysis jobs. It reads Version from client.go and, when the tag vX.Y.Z does not exist yet, creates the tag and the GitHub release with generated notes in one step; a push whose version is already tagged does nothing. Only this job gets contents: write, and a release concurrency group serialises its runs. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Add a Releasing section to the README: bump Version in client.go in a pull request and merge it; CI then tags vX.Y.Z and creates the GitHub release, and a merge whose version is already tagged releases nothing. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Summary
Merging a pull request that bumps
Versioninclient.gois now enough to cut a release: the CI workflow tags the merge commitvX.Y.Zand creates the GitHub release for it. No manual tagging is needed any more, and the README gains a short "Releasing" section for maintainers.How it works
releasejob in.github/workflows/ci.ymlruns only on pushes to the repository's default branch (master), after thetestmatrix andstaticcheckjobs have succeeded. It is the only job withcontents: write, and areleaseconcurrency group serialises its runs.Versionfromclient.gowithsed, derives the tagv<Version>, and checks for it withgit ls-remote --exit-code --tags origin refs/tags/<tag>.ls-remoteexits 2) it runsgh release create <tag> --target $GITHUB_SHA --title <tag> --generate-noteswith the workflow's own token, which creates the tag and the GitHub release in one step. When the tag already exists the job logs that and does nothing; any otherls-remotefailure fails the job without releasing.tagandcreatedoutputs. Nothing is published from CI: Go modules are fetched straight from the tag.pull_requestruns still execute onlytestandstaticcheck(the release job is skipped), and a tag or release created by hand keeps working.Note:
masteralready carriesVersion = "0.8.2"while the latest tag isv0.8.1, so the first push tomasterafter this is merged will createv0.8.2and its release at that merge commit.Verification
python3 -c 'import yaml,sys; [yaml.safe_load(open(f)) for f in sys.argv[1:]]' .github/workflows/*.ymlpasses.sed -nE 's/.*Version *= *"([^"]+)".*/\1/p' client.go | head -1, prints0.8.2against the checked-out file, andgit ls-remote --exit-code --tags origin refs/tags/v0.8.2exits 2 against the real repository, confirming the detection path.ghand the real remote: an untagged0.8.2producesgh release create v0.8.2 --target <sha> --title v0.8.2 --generate-notesandcreated=true; the tagged0.8.1logs "already exists" and setscreated=falsewithout callinggh; an unreachable remote fails the step with thels-remoteexit status; aclient.gowithoutVersionfails the step.releasejob itself cannot run before the merge; thepull_requestCI on this branch is the check available here.🤖 Generated with Claude Code