Skip to content

Tag and release from pushes to main - #254

Merged
ericmj merged 2 commits into
mainfrom
ericmj/release-from-main
Oct 22, 2026
Merged

ericmj merged 2 commits into
mainfrom
ericmj/release-from-main

Conversation

@ericmj

@ericmj ericmj commented Oct 22, 2026

Copy link
Copy Markdown
Member

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 from src/hex_core.app.src, tags the pushed commit v$VERSION when the tag 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. The tag is created through the GitHub API because the checkout keeps persist-credentials: false, and runs share a concurrency group so two pushes can't both tag and publish the same version.

.github/workflows/check_version.sh fails when src/hex_core.hrl or one of the README install snippets names a different version than src/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 release environment's deployment policy allows the main branch instead of v* tags.

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.
@ericmj ericmj mentioned this pull request Oct 22, 2026
@ericmj
ericmj merged commit b0e10fb into main Oct 22, 2026
10 checks passed
@ericmj
ericmj deleted the ericmj/release-from-main branch October 22, 2026 10:21
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