Repository navigation
Tag and release from pushes to main - #254
Merged
Merged
Conversation
The Release workflow ran when a v* tag was pushed by hand. It now runs on every push to main, like castore's publish workflow. It reads the version from src/hex_core.app.src, creates the v$VERSION tag on the pushed commit when it doesn't exist, publishes to Hex when mix hex.info doesn't find the version, and creates the GitHub release when it doesn't exist. A push that doesn't change the version skips all three, and re-running a failed run skips the steps that already succeeded. Runs share a concurrency group so two pushes can't both tag and publish the same version. The checkout keeps persist-credentials: false, so the tag is created with the GitHub API instead of git push. hex.pm matches a workload identity on the repository, the workflow file and the environment, and not on the ref, so the token exchange works from main the same way it does from a tag.
src/hex_core.hrl and the README install snippets repeat the version from src/hex_core.app.src, and a release that bumps only some of them still publishes. .github/workflows/check_version.sh fails when the version in src/hex_core.hrl or a README snippet differs from the one in src/hex_core.app.src, or when a snippet is missing. CI runs it, and the Release workflow runs it before tagging because on a push to main it runs next to CI and doesn't wait for it.
Merged
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.
The Release workflow now runs on every push to main instead of on a pushed
v*tag, the same way castore's publish workflow does (https://github.com/elixir-mint/castore/blob/main/.github/workflows/publish.yml). It reads the version fromsrc/hex_core.app.src, tags the pushed commitv$VERSIONwhen the tag doesn't exist, publishes to Hex whenmix hex.infodoesn't find the version and creates the GitHub release when it doesn't exist. A push that doesn't change the version skips all three, and re-running a failed run skips the steps that already succeeded. The tag is created through the GitHub API because the checkout keepspersist-credentials: false, and runs share a concurrency group so two pushes can't both tag and publish the same version..github/workflows/check_version.shfails whensrc/hex_core.hrlor one of the README install snippets names a different version thansrc/hex_core.app.src, or when a snippet is missing. CI runs it on the lint job, and the Release workflow runs it before tagging because on a push to main it runs next to CI and doesn't wait for it.The
releaseenvironment's deployment policy allows themainbranch instead ofv*tags.