Version release for elixir

GitHub release (latest by date) Hex.pm Hex.pm Docs

Project version and changelog managment for elixir. Insparation for functionality is taken from cargo-release package for Rust

Performs release best-practices, including:

  • Ensure the git working directory is clean.
  • Bump the version in mix.exs
  • Create a git tag for this version
  • Run mix release (disabled by default)
  • Bump version for next development cycle
  • Push everything to github

Install

Current release: 0.0.1-beta.14

Add to mix.exs

def deps do
  [
    ...other
    {:version_release, "0.0.1-beta.14", only: :dev, runtime: false}
    ...other
  ]
end

Usage

mix version.[level] [--dry-run | -dr] [--no-git-push | -np]

leveldescription
majorCreates major realease version. I.e. from 1.2.3 to 2.2.3
minorCreates minor realease version. I.e. from 1.2.3 to 1.3.3
patchCreates patch realease version. I.e. from 1.2.3 to 1.2.4
rcCreates realease candidate version. I.e. from 1.2.3 to 1.2.4-rc.0
betaCreates beta realease version. I.e. from 1.2.3 to 1.2.4-beta.0
alphaCreates alpha realease version. I.e. from 1.2.3 to 1.2.4-alpha.0

Settings

NameTypeDescription
tag_prefixStringTag prefix usually just v (short for version). Will be created from version. I.e. if version is 1.2.3 and tag prefix is "ver" resulting tag will be ver1.2.3
hex_publishBooleanDisabled by default. Enable publishing to hex.pm Should authorize beforehand. Check Publishing a package article.
git_pushBooleanEnabled by default. Enable git push at the endof all operations
changelogConfigConfiguration for changelog. Check Changelog section
mergeConfigConfiguration for mergeing. Check Merging section

Prerequisite

  • Your project should be managed by git.

Changelog

Why keep a changelog and how

Settings

NameTypeDescription
creationAtomMode of creation.
replacementsConfig[]List of replacement settings

Creation settings

OptionDescription
disabledChangelog will not be created
manualChangelog will updated accordingly to replacements settings. Replacement values are {{version}}, {{date}}, {{tag_name}}. Everything that actually has changed should be written directly to changelog file
git_logs!Not implemented! Same as manual, but additionally if git commit massage starts with add!, change!, fix!, message will be added to changelog.

Replacements settings

NameTypeDescription
fileStringFile name in which to do replacements.
patternsConfig[]List of pattern settings

Patterns settings

NameTypeDescription
searchString/RegExPattern to serch in specified file
replaceStringString which will replace what is found. ({{version}}, {{date}}, {{tag_name}} Will be replaced accordingly)
globalBooleanFile name in which to do replacements.

Examples

Check this repo config or elixir-version-release-tests repo config to have some examples how to configure chanelog updates.

Merging (Not implemented)

Sometimes it is useful to keep 2 or more branches up to date with the branch that you are doing version bump from

License

Licensed under MIT license

PS

If you found this library useful, dont forget to star it (on github) =)

GitHub stars