Hex.pmHexdocs.pmGithub.com

Expublish

Automate SemVer and best practices for elixir package releases.

Installation

Add :expublish to your dev dependencies in mix.exs:

{:expublish, "~> 2.1", only: [:dev]}

Create a CHANGELOG.md in the root folder of your project. It must contain a placeholder:

<!-- %% CHANGELOG_ENTRIES %% -->

Do not keep track of the release file. Put the following line in your .gitignore:

RELEASE.md

The file is deleted after every successful release.

Usage

1. Create a new RELEASE.md containing the new changelog entry:

$ echo "- changelog entry one\n- changelog entry two" > RELEASE.md

2. Run one of mix expublish.(major|minor|patch):

$ mix expublish.minor

About

Using mix expublish guarantees:

Expublish was built with a CI integrated continuous release process in mind. The mix task makes certain assumptions and automatically pushes and publishes the new package version to git and hex respectively.

This and other behavior can be changed using various options. Here are the commonly used ones:

# Go through all the task steps without any writing changes (no commit, no tag, no push, no publish):
$ mix expublish.minor --dry-run

# Do not push the new version commit and tag to git and do not publish the new package on hex:
$ mix expublish.minor --disable-push --disable-publish

# Skip the test run:
$ mix expublish.minor --disable-test

# Ignore untracked files in git check before creating a new release:
$ mix expublish.minor --allow-untracked

# Push the git commit to a different branch and/or remote:
$ mix expublish.minor --branch=release --remote=upstream

Reference

The mix task is defined as:

mix expublish.[level] [options]

Level

Level Description
major When making incompatible API changes.
minor When adding functionality in a backwards compatible manner.
patch When making backwards compatible bug fixes.

Options

Option Default Description
-h, --helpfalse Print help.
-d, --dry-runfalse Perform dry run (no writes, no commits).
--allow-untrackedfalse Skip untracked files when checking git porcelain.
--disable-testfalse Disable test run.
--disable-publishfalse Disable hex publish.
--disable-pushfalse Disable git push.
--branch=string"master" Remote branch for git push.
--remote=string"origin" Remote name for git push.
--commit-prefix=string"Version release" Prefix for commit message.
--tag-prefix=string"v" Prefix for release tag.

Apart from the mix task, Expublish exposes a public interface which can be used to create new releases from other elixir applications or scripts.