|
@@ -119,57 +119,63 @@ $ bin/example_release.cmd upgrade "2/example_release"
|
|
|
|
|
|
Your release was upgraded!
|
|
Your release was upgraded!
|
|
|
|
|
|
-=== Getting relx semver value
|
|
|
|
|
|
+=== Getting Relx semver value
|
|
|
|
|
|
-There is a *workaround* to get the semver version value which is
|
|
|
|
-generated by relx based on VCS history.
|
|
|
|
|
|
+There is a *workaround* to get the semver value which is
|
|
|
|
+generated by Relx based on VCS history.
|
|
|
|
|
|
-Create `rel/version` file with only one line inside:
|
|
|
|
|
|
+Create a file 'rel/version' with only one line inside:
|
|
|
|
|
|
[source,erlang]
|
|
[source,erlang]
|
|
{{ release_version }}
|
|
{{ release_version }}
|
|
|
|
|
|
-Add/Update `overlay` section of your `relx.config`
|
|
|
|
|
|
+Add/Update the `overlay` section of your `relx.config`:
|
|
|
|
|
|
[source,erlang]
|
|
[source,erlang]
|
|
{overlay, [
|
|
{overlay, [
|
|
- {template, rel/version, version}
|
|
|
|
|
|
+ {template, "rel/version", "version"}
|
|
]}.
|
|
]}.
|
|
|
|
|
|
-So when you run `mare rel` it creates file like `_rel/app/version` which
|
|
|
|
-would contain the version value generated by relx
|
|
|
|
|
|
+When you run `mare rel` it creates the file '$(RELX_OUTPUT_DIR)/example/version'
|
|
|
|
+which contains the version value generated by Relx.
|
|
|
|
|
|
[source,bash]
|
|
[source,bash]
|
|
$ cat _rel/app/release
|
|
$ cat _rel/app/release
|
|
1.0.0+build.11.ref5612aa0
|
|
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 `rel` target
|
|
|
|
|
|
+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]
|
|
[source,make]
|
|
$(shell cat $(RELX_OUTPUT_DIR)/$(RELX_REL_NAME)/version)
|
|
$(shell cat $(RELX_OUTPUT_DIR)/$(RELX_REL_NAME)/version)
|
|
|
|
|
|
-Here is an example of the `Makefile`:
|
|
|
|
|
|
+For example:
|
|
|
|
+
|
|
[source,make]
|
|
[source,make]
|
|
|
|
+----
|
|
include erlang.mk
|
|
include erlang.mk
|
|
-#--------------------------- Custom targets -----------------------------------
|
|
|
|
|
|
+
|
|
APP_VERSION = $(shell cat $(RELX_OUTPUT_DIR)/$(RELX_REL_NAME)/version)
|
|
APP_VERSION = $(shell cat $(RELX_OUTPUT_DIR)/$(RELX_REL_NAME)/version)
|
|
myrecipe: all
|
|
myrecipe: all
|
|
echo APP_VERSION = $(APP_VERSION)
|
|
echo APP_VERSION = $(APP_VERSION)
|
|
|
|
+----
|
|
|
|
+
|
|
|
|
+Would output:
|
|
|
|
|
|
-The output would be like:
|
|
|
|
[source,bash]
|
|
[source,bash]
|
|
|
|
+----
|
|
$ make myrecipe
|
|
$ make myrecipe
|
|
...
|
|
...
|
|
===> Starting relx build process ...
|
|
===> Starting relx build process ...
|
|
===> Resolving OTP Applications from directories:
|
|
===> Resolving OTP Applications from directories:
|
|
- /home/username/myapp/apps
|
|
|
|
- /home/username/myapp/deps
|
|
|
|
|
|
+ /home/username/example/apps
|
|
|
|
+ /home/username/example/deps
|
|
/usr/lib/erlang/lib
|
|
/usr/lib/erlang/lib
|
|
- /home/username/myapp/_rel
|
|
|
|
-===> Resolved myapp-0.3.10+build.11.ref5612aa0
|
|
|
|
|
|
+ /home/username/example/_rel
|
|
|
|
+===> Resolved example-0.3.10+build.11.ref5612aa0
|
|
===> Including Erts from /usr/lib/erlang
|
|
===> Including Erts from /usr/lib/erlang
|
|
===> release successfully created!
|
|
===> release successfully created!
|
|
-===> tarball /home/username/myapp/_rel/myapp/myapp-0.3.10+build.11.ref5612aa0.tar.gz 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
|
|
echo APP_VERSION = 0.3.10+build.11.ref5612aa0
|
|
APP_VERSION = 0.3.10+build.11.ref5612aa0
|
|
APP_VERSION = 0.3.10+build.11.ref5612aa0
|
|
|
|
+----
|