mix publish (plumb v0.2.0)

Copy Markdown View Source

Releases the project: verify, bump, commit, tag, push, publish.

mix publish patch          # 0.1.1 -> 0.1.2
mix publish minor          # 0.1.1 -> 0.2.0
mix publish major          # 0.1.1 -> 1.0.0
mix publish 0.4.0-rc.1     # an explicit version, which must sort above the current one

Every check runs before anything is written, and the first failure stops the task, so a run that fails verification leaves the repository exactly as it was. In order: the working tree must be clean, the target tag must not already exist locally or on the remote, then the README install snippet must fit the version being released, and mix format --check-formatted, mix test and mix docs must each pass.

Only then is mix.exs rewritten, committed as Release vX.Y.Z, tagged vX.Y.Z, and pushed together with its tag — the tag reaches the remote before anything is uploaded, so the source_ref in the published docs resolves as soon as they are live. mix hex.publish then uploads the package and its documentation, prompting for confirmation as usual.

The version is read from a @version "..." attribute, or from a literal version: "..." in the project config when there is no attribute. See Plumb.Release.rewrite/2.

Configuration

The README check is off unless asked for, since README shapes vary. Add a :plumb key to project/0:

plumb: [readme: :exact]
  • :readmefalse (default), :satisfies, or :exact. See Plumb.Readme
  • :readme_path — default "README.md"

It is checked against the version being released, not the one in mix.exs, so a release that would leave the install instructions wrong fails before the bump.

Options

  • --dry-run — run every check and build the tarball, reporting each step that would follow, without writing, committing, tagging, pushing or uploading
  • --remote — the git remote to push to, default origin
  • --allow-untracked — let untracked files through the clean-tree check. Tracked changes still block it, and untracked files are not committed
  • --skip — comma-separated checks to leave out: readme, format, test, docs. An escape hatch for a project that has no ex_doc, not a habit