From f3ab9ef65d948469e864184bcf95114bf8025ad1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 9 Jun 2017 11:44:12 +0200 Subject: Release the tale of 2.0 cowboy slides --- docs/en/erlang.mk/1/guide/releases.asciidoc | 61 +++++++++++++++++++++++++++ docs/en/erlang.mk/1/guide/releases/index.html | 59 ++++++++++++++++++++++++++ 2 files changed, 120 insertions(+) (limited to 'docs/en/erlang.mk/1/guide') 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 +---- diff --git a/docs/en/erlang.mk/1/guide/releases/index.html b/docs/en/erlang.mk/1/guide/releases/index.html index 9ebd52ba..e3c46057 100644 --- a/docs/en/erlang.mk/1/guide/releases/index.html +++ b/docs/en/erlang.mk/1/guide/releases/index.html @@ -195,6 +195,65 @@ http://www.gnu.org/software/src-highlite -->

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:

+
+
+
{{ release_version }}
+

Add/Update the overlay section of your relx.config:

+
+
+
{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.

+
+
+
$ 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:

+
+
+

For example:

+
+
+

Would output:

+
+
+
$ 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
+
+
-- cgit v1.2.3