mix publish (plumb v0.2.8)

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 publishes the version already in mix.exs rather than bumping, which covers a first release and a release whose upload did not happen.

Where the tag already exists it must be on the remote, point at the same commit in both, and have HEAD on it; nothing is then written, committed or tagged. Where no tag exists, HEAD is tagged and pushed before the upload. mix.exs is never rewritten either way.

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, mix format --check-formatted, mix test and mix docs must each pass, and mix hex.build must produce a valid package.

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, build
  • --yes — skip the confirmation prompt