Skip to content

Commit

Permalink
Merge pull request #854 from tsloughter/release-env-vars
Browse files Browse the repository at this point in the history
add exports of RELEASE_NAME, RELEASE_VERSION and RELEASE_PROG to script
  • Loading branch information
tsloughter authored Feb 19, 2021
2 parents 1646540 + 35a9813 commit bacd656
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 1 deletion.
8 changes: 7 additions & 1 deletion priv/templates/bin
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ if [ -z "$SCRIPT" ]; then
fi;
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT")" && pwd -P)"
RELEASE_ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd -P)"
REL_NAME="{{ rel_name }}"
export REL_NAME="{{ rel_name }}"
REL_VSN="{{ rel_vsn }}"

# export these to match mix release environment variables
export RELEASE_NAME="{{ rel_name }}"
export RELEASE_VSN="{{ rel_vsn }}"
export RELEASE_PROG="${SCRIPT}"

ERTS_VSN="{{ erts_vsn }}"
REL_DIR="$RELEASE_ROOT_DIR/releases/$REL_VSN"
ERL_OPTS="{{ erl_opts }}"
Expand Down
5 changes: 5 additions & 0 deletions priv/templates/bin_windows
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ set rel_vsn={{ rel_vsn }}
set erts_vsn={{ erts_vsn }}
set erl_opts={{ erl_opts }}

:: export these to match mix release environment variables
set RELEASE_NAME={{ rel_name }}
set RELEASE_VSN={{ rel_vsn }}
set RELEASE_PROG=%~nx0

:: Set the root release directory based on the location of this batch file
set script_dir=%~dp0
for %%A in ("%script_dir%\..") do (
Expand Down
5 changes: 5 additions & 0 deletions priv/templates/bin_windows_ps
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ $rel_vsn = '{{ rel_vsn }}'
$erts_vsn = '{{ erts_vsn }}'
$erl_opts = '{{ erl_opts }}'

# export these to match mix release environment variables
$RELEASE_NAME = '{{ rel_name }}'
$RELEASE_VERSION = '{{ rel_vsn }}'
$RELEASE_PROG = $MyInvocation.MyCommand.Name

# Ensure we have PSScriptRoot
if (!(Test-Path variable:global:PSScriptRoot)) {
# Support for powershell 2.0
Expand Down
6 changes: 6 additions & 0 deletions priv/templates/extended_bin
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ RELEASE_ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd -P)"
# Make the value available to variable substitution calls below
export REL_NAME="{{ rel_name }}"
REL_VSN="{{ rel_vsn }}"

# export these to match mix release environment variables
export RELEASE_NAME="{{ rel_name }}"
export RELEASE_VSN="{{ rel_vsn }}"
export RELEASE_PROG="${SCRIPT}"

ERTS_VSN="{{ erts_vsn }}"
REL_DIR="$RELEASE_ROOT_DIR/releases/$REL_VSN"
RUNNER_LOG_DIR="${RUNNER_LOG_DIR:-$RELEASE_ROOT_DIR/log}"
Expand Down
5 changes: 5 additions & 0 deletions priv/templates/extended_bin_windows
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ set rel_vsn={{ rel_vsn }}
set erts_vsn={{ erts_vsn }}
set erl_opts={{ erl_opts }}

:: export these to match mix release environment variables
set RELEASE_NAME={{ rel_name }}
set RELEASE_VSN={{ rel_vsn }}
set RELEASE_PROG=%~nx0

:: Make sure `findstr` is accessible
set PATH=%PATH%;%SystemRoot%\System32

Expand Down
5 changes: 5 additions & 0 deletions priv/templates/extended_bin_windows_ps
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ $rel_vsn = '{{ rel_vsn }}'
$erts_vsn = '{{ erts_vsn }}'
$erl_opts = '{{ erl_opts }}'

# export these to match mix release environment variables
$RELEASE_NAME = '{{ rel_name }}'
$RELEASE_VERSION = '{{ rel_vsn }}'
$RELEASE_PROG = $MyInvocation.MyCommand.Name

# Ensure we have PSScriptRoot
if (!(Test-Path variable:global:PSScriptRoot)) {
# Support powershell 2.0
Expand Down

0 comments on commit bacd656

Please sign in to comment.