Hex.pm Hexdocs.pm Github.com

Expublish

Automate SemVer and best practices for elixir package releases.

How to install

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, as it's deleted with every successful release. Put the following line in your .gitignore:

RELEASE.md

How to use

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

3. That's it!

About the package

Using mix expublish guarantees:

Expublish was built with a fully automated continuous release process in mind. This is why it makes some expectations 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, --help false Print help.
-d, --dry-run false Perform dry run (no writes, no commits).
--allow-untracked false Skip untracked files when checking git porcelain.
--disable-test false Disable test run.
--disable-publish false Disable hex publish.
--disable-push false Disable git push.
--branch=string "master" Remote branch for git push.
--remote=string "origin" Remote name for git push.

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