mix version (mix_version v2.5.0)

View Source

This module implements a mix task whose main purpose is to update the version number of an Elixir application, with extra steps such as committing a git tag.

Configuration

Configuration can be provided under :versioning from the project/0 callback of the project file:

# in mix.exs

def project do
  [
    app: :my_app,
    version: "1.2.3",
    # ...
    versioning: versioning()
  ]
end

defp versioning do
  [
    annotate:   true,
    annotation: "new version %s",
    commit_msg: "new version %s",
    tag_prefix: "v"
  ]
end

In the commit message and annotation, any occurence of %s will be replaced by the new version number. The presence of %s is not mandatory.

This configuration is totally optional. The sample values above are the default values used by mix version.

Configuration can be overriden by command line options. For instance, if :annotate is set to false in configuration, you can use the --annotate CLI flag to force it to be true.

Synopsis

mix version [options]

Options

  • -i, --info - Only outputs the current version and stops. Ignores all other options. Defaults to false.
  • -M, --major - Bump to a new major version. Defaults to false.
  • -m, --minor - Bump to a new minor version. Defaults to false.
  • -p, --patch - Bump the patch version. Defaults to false.
  • -n, --new-version <string> - Set the new version number. Defaults to nil.
  • -a, --annotate - Create an annotated git tag. Defaults is pulled from mix.exs with fallback to true.
  • -c, --commit-msg <string> - Define the commit message, with all '%s' replaced by the new VSN. Defaults is pulled from mix.exs with fallback to "new version %s".
  • -A, --annotation <string> - Define the tag annotation message, with all '%s' replaced by the new VSN. Defaults is pulled from mix.exs with fallback to "new version %s".
  • -x, --tag-prefix <string> - Define the tag prefix. Defaults is pulled from mix.exs with fallback to "v".
  • -k, --tag-current - Commit and tag with the current version. Defaults to false.
  • --help - Displays this help.

Summary

Functions

default_opt(atom)