mix publish (plumb v0.2.4)

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
mix publish current        # upload the version already in mix.exs

current uploads the version already in mix.exs. It requires the tag for that version to exist locally, to be on the remote, to point at the same commit in both, and HEAD to be on it. Nothing is written, committed or tagged.

Every check runs before anything is written, and the first failure stops the task. In order: the working tree must be clean, the target tag must not already exist locally or on the remote, the README install snippet must fit the version being released, and mix format --check-formatted, mix test and mix docs must each pass.

Confirmation is asked once the checks have passed. On y, mix.exs is rewritten, committed as Release vX.Y.Z, tagged vX.Y.Z, and pushed with its tag; the tag reaches the remote before the upload, so source_ref in the published docs resolves as soon as they are live. mix hex.publish then uploads the package and its documentation.

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 names the wrong requirement 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
  • --yes — skip the confirmation prompt