Asserts release-metadata consistency before publishing to Hex.
Catches the class of mistakes that precommit/quality.ci cannot see —
version/CHANGELOG/migration drift and unsafe git state — and exits non-zero
on any failure so it can gate mix hex.publish. It is the semantic core of
the mix prerelease alias and runs without a database.
Usage
$ mix phoenix_kit.release_check
$ mix phoenix_kit.release_check --allow-dirty --allow-branch
Options
--allow-dirty— downgrade the "working tree clean" check to a warning--allow-branch— downgrade the "on main branch" check to a warning
Checks Performed
- CHANGELOG Heading — top
## X.Y.Zentry matchesmix.exs@version(and is a real version, not "Unreleased"). - CHANGELOG Body — that entry has at least one content line.
- Migration Version Sync — code/disk/module consistency for the
versioned migration chain:
Migrations.Postgres.current_version/0equals the highestvNNN.exfile on disk.Migrations.Postgres.initial_version/0equals the LOWESTvNNN.exfile on disk (catches an orphaned below-floor file, or a floor bump that left the old file behind).- every version in
initial_version/0..current_version/0has both avNNN.exfile on disk AND a loadablePhoenixKit.Migrations.Postgres.VNNNmodule — catches an accidentally deleted delta file. - when
PhoenixKit.Migrations.ExpectedSchema(the tool-generated verify-and-repair manifest, squash spec §5.1/§8.3) is loaded, itschain_hash/0must match a fresh SHA-256 over the samevNNN.exfile set — catches a migration added without regenerating the manifest. While the manifest does not exist yet (pre-squash, P2, pending the operator scratch DB), this prints an explicit SKIP notice instead of failing — seedev_docs/plans/2026-07-14-squash-migrations-spec.md.
- Git Tree Clean — no uncommitted changes (
--allow-dirtyto warn). - Git Branch — on
main(--allow-branchto warn). - Tag Collision — tag
v<version>does not already exist (publish- before-tag means a pre-existing tag signals a double release).