edeliver_fork v1.4.6 mix release.version
Displays the release version or modifies it before building the release.
This task can be used in conjunction with the release task to modify
the version for the release / upgrade. The compiled files must be cleaned
before and the release task must be executed after. Increasing version
and appending metadata to the version can be combined, e.g:
mix do clean, release.version increment minor append-git-revision append-branch, release
To automatically append metadata, you can set the $AUTO_VERSION environment variable.
Usage:
mix release.version showmix do clean, release.version Append-Metadata... [Option], releasemix do clean, release.version increment [patch|minor|major] [version] [Append-Metadata...] [Option], releasemix do clean, release.version set <new-version> [Append-Metadata...] [Option], release
Append-Metadata
[append-][git-]revisionAppends sha1 git revision of current HEAD[append-][git-]branch[-unless-master]Appends the current branch that is built. If-unless-masteris used, the branch is only appended unless it is the master branch.[append-][build-]dateAppends the build date as YYYYMMDD[append-][git-]commit-count[-all[-branches]|-branch]Appends the number of commits[append-]mix-envAppends the mix environment used while building the release from the current branch or across all branches (default). Appending the commit count from the current branch makes more sense, if the branch name is also appended as metadata to avoid conflicts from different branches.
Version Modification
showDisplays the current release version.incrementIncrements the release version for the current buildpatchIncrements the patch version (default). The last part of a tripartite version.minorIncrements the minor version. The middle part of a tripartite version.majorIncrements the major version. The first part of a tripartite version.
set <new-version>Sets the release version for the current build
Options
-V,--verboseVerbose output-Q,--quietPrint only errors while modifying version-D,--dry-runPrint only new version without changing it
Environment Variables
AUTO_VERSIONas long no arguments are passed directly which append metadata to the version (flags from the Append-Metadata section) the values from that env are used to append metadata.
Example
  MIX_ENV=prod mix do clean, release.version append-git-revision, release
Link to this section Summary
Functions
Gets the current branch that will be built. Since the git repository on the build
  host is usually in a detatched state because a specific revision is checked out
  when building (see git_reset_remote() in libexec/common), this won’t work
Gets the current number of commits across all branches
Gets the current number of commits in the current branch
Gets the current date in the form yyyymmdd
Gets the current revision of the git repository edeliver is used as deploy tool for. The sha1 hash containing 7 hexadecimal characters is returned
Gets the version which should be set as fixed version (instead of incrementing) from the args and returns the args without that value
Modifies the current release version by applying the modification_funs which
  were collected while parsing the args. If there was an error parsing the arguments
  passed to this task, this function prints the error and exists the erlang vm, meaning
  aborting the mix task. If :show is returned from parsing the arguments, this function
  just prints the current release version
Normalizes the arguments passed to this task. This is done by
  splitting arguments separated by a +, removing leading append-
  -git and -build strings and renaming commit-count to
  commit_count
Parses the arguments passed to this release.version task and merges them
  with the AUTO_VERSION environment variable. This arguments must not contain
  any output flags like -V or -Q
A task needs to implement run which receives
a list of command line args
Sorts the args in that way, that all args incrementing or setting the version come first
and all args appending metadata come last by not changing their particular order
Link to this section Types
modification_fun() :: (modification_arg() -> modification_arg())
Link to this section Functions
  Gets the current branch that will be built. Since the git repository on the build
  host is usually in a detatched state because a specific revision is checked out
  when building (see git_reset_remote() in libexec/common), this won’t work:
  git rev-parse --abbrev-ref HEAD
Instead
  git branch --contains <revision> could be used. But the commit/revision can still
  be in several branches, e.g. if one branch containing that commit was built before
  and that branch is later merged and built again. Then the old branch exists still
  on the build host and the commit exists in both branches. So whenever possible we
  will pass the branch which is built as BRANCH env, but as fallback we try to
  autodetect the branch which contains the current commit that is built.
Gets the current number of commits across all branches
Gets the current number of commits in the current branch
Gets the current date in the form yyyymmdd
Gets the current revision of the git repository edeliver is used as deploy tool for. The sha1 hash containing 7 hexadecimal characters is returned.
get_version_to_set_from_args( args :: OptionParser.argv(), remaining_args :: OptionParser.argv() ) :: {version_to_set :: String.t() | nil, args_without_version :: OptionParser.argv()}
Gets the version which should be set as fixed version (instead of incrementing) from the args and returns the args without that value.
modify_version(
  {:modify, [modification_fun()]} | {:error, message :: String.t()} | :show,
  version :: String.t()
) :: :ok | :error | {:modified, new_version :: String.t()}
        
        Modifies the current release version by applying the modification_funs which
  were collected while parsing the args. If there was an error parsing the arguments
  passed to this task, this function prints the error and exists the erlang vm, meaning
  aborting the mix task. If :show is returned from parsing the arguments, this function
  just prints the current release version.
normalize_args(OptionParser.argv()) :: OptionParser.argv()
  Normalizes the arguments passed to this task. This is done by
  splitting arguments separated by a +, removing leading append-
  -git and -build strings and renaming commit-count to
  commit_count
parse_args(OptionParser.argv()) :: :show | {:error, message :: String.t()} | {:modify, [modification_fun()]}
  Parses the arguments passed to this release.version task and merges them
  with the AUTO_VERSION environment variable. This arguments must not contain
  any output flags like -V or -Q.
A task needs to implement run which receives
a list of command line args.
Callback implementation for Mix.Task.run/1.
sort_args_append_metadata_last( args :: OptionParser.argv(), increment_version_args :: OptionParser.argv(), append_metadata_args :: OptionParser.argv() ) :: args :: OptionParser.argv()
Sorts the args in that way, that all args incrementing or setting the version come first
and all args appending metadata come last by not changing their particular order.