mix publish (gusex v1.3.0)

Copy Markdown View Source

Publishes the package to hex.pm with pre-flight checks and version management.

Usage

mix publish             # Full publish workflow
mix publish --dry-run   # Run checks and build, but don't publish
mix publish --skip-checks # Skip pre-flight checks
mix publish --revert    # Revert current version from hex.pm
mix publish --republish # Revert and republish in one step

Pre-flight Checks

  1. Hex authentication - verifies you're logged in to hex.pm
  2. Git status - warns if uncommitted changes exist
  3. Tests - runs mix test and aborts on failure
  4. Credo - runs mix credo and prompts to continue if issues are found
  5. Version check - compares local version with hex.pm

If the local version matches the published version, you'll be prompted to bump the version (patch/minor/major/custom).

Post-publish

After successful publish, creates a git tag (e.g., v1.0.1) and optionally pushes it to the remote.

Revert and Republish

Hex.pm allows reverting a published version within 1 hour of publication. The --revert flag reverts the current version from hex.pm. The --republish flag combines revert + republish in one step, useful for last-minute fixes without bumping the version number.

Time-based warnings are displayed:

  • No warning if plenty of time remains (> 10 minutes)
  • Yellow warning when < 10 minutes remain
  • Red warning if the 1-hour window has expired (operation will likely fail)

On republish, the git tag is replaced (deleted locally and remotely, then recreated).