ref:main

Add automatic CI-driven release process #21

closed Opened by cole.christensen@gmail.com

Links

No links yet.

Problem

There is no automated release process. Versioning is hard-coded in mix.exs ("0.1.0"), there is no CI step to create releases, and publishing to Hex requires manual intervention. The huorn-minecraft project has a working model: CalVer version computation, automatic changelog from git log, artifact attachment, and tag creation — all driven by Anvil CI.

Desired Workflow

On every push to main, after all checks pass (compile, format, dialyzer, test):

  1. Compute version — CalVer YYYY.MM.BUILD (e.g., 2026.04.1), incrementing build within a month, resetting on new month. Query anvil release list for the latest tag.
  2. Buildmix compile --warnings-as-errors (already exists)
  3. Testmix test (already exists)
  4. Generate changeloggit log --oneline <last-tag>..HEAD
  5. Create Hex packagemix hex.build to produce the .tar artifact
  6. Create Anvil releaseanvil release create --tag <VERSION> --title "ExGitObjectstore <VERSION>" --body "<CHANGELOG>" --attach <hex-tar>
  7. Tag commitgit tag <VERSION> && git push origin <VERSION>

Acceptance Criteria

  • ci/release.sh script computes CalVer version from anvil release list
  • .anvil.yml has a release step that runs after all checks pass, only on main
  • mix.exs version is dynamically set from $VERSION env var at build time, falling back to "0.0.0-dev" for local builds
  • Changelog is auto-generated from git log between previous tag and HEAD
  • Anvil release is created with the version tag, changelog body, and hex package attached
  • Git tag is created and pushed for each release
  • ExDoc is generated and attached to the release as a tarball
  • Release step is idempotent — re-running on same commit doesn’t create duplicates
  • Local mix compile and mix test still work without $VERSION set (dev default)

Notes

  • Modeled after huorn-minecraft’s ci/release.sh + .anvil-ci.yml pattern
  • CalVer chosen over SemVer because this library is under active development with frequent releases — CalVer avoids bikeshedding on major/minor/patch
  • Hex publishing can be deferred (requires API key setup) — initial version should create the Anvil release + tag only