Repository navigation
Release automatically when the version changes - #14
Merged
Merged
Conversation
Add a release job to the CI workflow that runs after the tests on every push to the default branch. It reads vsn from src/ipdata.app.src and, when the tag vX.Y.Z does not exist yet, creates the tag and the GitHub release with gh release create. The publish job now also runs when that job created a tag, in the same workflow run, because a tag created with the workflow's own token does not start another run. A tag pushed by hand still publishes as before. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Add a Releasing section after Testing: bump vsn in a pull request, merge, and CI tags the merge commit, creates the release and publishes to Hex.pm. 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 version bump to
mainis now enough to publish a release: CI tags the merge commit, creates the GitHub release and publishes the package and its documentation to Hex.pm. No manual tagging is needed any more; a tag pushed by hand still publishes as before.How it works
releasejob in.github/workflows/publish.ymlruns after the tests on every push to the default branch, withpermissions: contents: writeand areleaseconcurrency group. It readsvsnfromsrc/ipdata.app.src, derives the tagvX.Y.Zand checks it withgit ls-remote --exit-code --tags origin. When the tag is missing it runsgh release create "$TAG" --target "$GITHUB_SHA" --title "$TAG" --generate-noteswith the workflow's ownGITHUB_TOKEN, which creates the tag and the release in one step, and sets the job outputstagandcreated. When the tag already exists it does nothing and says so.publishjob now also depends onreleaseand runs in the same run whenneeds.release.outputs.created == 'true'. The previousrefs/tags/v*gate is kept as an alternative, so a tag pushed by hand still publishes; the condition uses!cancelled()because the release job is skipped on that path. The publish steps and the secret they use are unchanged.Verification
python3 -c 'import yaml,sys; [yaml.safe_load(open(f)) for f in sys.argv[1:]]' .github/workflows/*.ymlpasses andactionlintv1.7.12 reports nothing.1.1.0for the checked-outsrc/ipdata.app.src.gh: forv1.1.0(not tagged yet) they producegh release create v1.1.0 --target <sha> --title v1.1.0 --generate-notesandcreated=true; forv1.0.1(already tagged) they report that the tag exists and setcreated=false; whengit ls-remotefails for another reason the step fails without setting an output.vsnis already1.1.0while the newest tag isv1.0.1(Hex.pm has 1.0.0 and 1.0.1), so merging this pull request will createv1.1.0and publish 1.1.0.🤖 Generated with Claude Code