diff options
Diffstat (limited to 'docs/en/erlang.mk/1/guide/releases.asciidoc')
-rw-r--r-- | docs/en/erlang.mk/1/guide/releases.asciidoc | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/docs/en/erlang.mk/1/guide/releases.asciidoc b/docs/en/erlang.mk/1/guide/releases.asciidoc index 67abe879..f1e20e6b 100644 --- a/docs/en/erlang.mk/1/guide/releases.asciidoc +++ b/docs/en/erlang.mk/1/guide/releases.asciidoc @@ -118,3 +118,64 @@ Or on Windows: $ bin/example_release.cmd upgrade "2/example_release" Your release was upgraded! + +=== Getting Relx semver value + +There is a *workaround* to get the semver value which is +generated by Relx based on VCS history. + +Create a file 'rel/version' with only one line inside: + +[source,erlang] +{{ release_version }} + +Add/Update the `overlay` section of your `relx.config`: + +[source,erlang] +{overlay, [ + {template, "rel/version", "version"} +]}. + +When you run `make rel` it creates the file '$(RELX_OUTPUT_DIR)/example/version' +which contains the version value generated by Relx. + +[source,bash] +$ cat _rel/app/release +1.0.0+build.11.ref5612aa0 + +In your `Makefile` you can use this simple snippet to get the version, +but please keep in mind that this should depend on the `rel` target: + +[source,make] +$(shell cat $(RELX_OUTPUT_DIR)/$(RELX_REL_NAME)/version) + +For example: + +[source,make] +---- +include erlang.mk + +APP_VERSION = $(shell cat $(RELX_OUTPUT_DIR)/$(RELX_REL_NAME)/version) +myrecipe: all + echo APP_VERSION = $(APP_VERSION) +---- + +Would output: + +[source,bash] +---- +$ make myrecipe +... +===> Starting relx build process ... +===> Resolving OTP Applications from directories: + /home/username/example/apps + /home/username/example/deps + /usr/lib/erlang/lib + /home/username/example/_rel +===> Resolved example-0.3.10+build.11.ref5612aa0 +===> Including Erts from /usr/lib/erlang +===> release successfully created! +===> tarball /home/username/example/_rel/example/example-0.3.10+build.11.ref5612aa0.tar.gz successfully created! +echo APP_VERSION = 0.3.10+build.11.ref5612aa0 +APP_VERSION = 0.3.10+build.11.ref5612aa0 +---- |