-
Notifications
You must be signed in to change notification settings - Fork 186
Run additional build tasks
Stefan Wintermeyer edited this page Mar 16, 2020
·
12 revisions
You can run additional tasks on the build host like phoenix.digest
or npm install
by adding
pre- or posthooks to your edeliver config file (usually in .deliver/config
)
e.g. like that:
# .deliver/config
pre_erlang_clean_compile() {
status "Running phoenix.digest" # log output prepended with "----->"
__sync_remote " # runs the commands on the build host
[ -f ~/.profile ] && source ~/.profile # load profile (optional)
set -e # fail if any command fails (recommended)
cd '$BUILD_AT' # enter the build directory on the build host (required)
# prepare something
mkdir -p priv/static # required by the phx.digest task
# run your custom task
APP='$APP' MIX_ENV='$TARGET_MIX_ENV' $MIX_CMD phx.digest $SILENCE
"
}
pre_erlang_clean_compile()
will be invoked before the -----> Compiling sources
step.
__sync_remote
executes the commands on the build host.
[ -f ~/.profile ] && source ~/.profile
and set -e
are optional but edeliver default.
cd $BUILD_AT
is required to enter the build directory.
$SILENCE
redirects the output to /dev/null
unless --verbose
option is used.
After that any command can be invoked to execute additional build tasks, e.g. like phx.digest
or npm install
.
Other pre- / posthooks are:
Pre- / Post Hook | Executed when |
---|---|
pre_init_app_remotely() |
before -----> Ensuring hosts are ready to accept git pushes
|
post_init_app_remotely() |
after -----> Ensuring hosts are ready to accept git pushes
|
pre_git_push() |
before -----> Pushing new commits with git to: host xy
|
post_git_push() |
after -----> Pushing new commits with git to: host xy
|
pre_erlang_get_and_update_deps() |
before -----> Fetching / Updating dependencies
|
post_erlang_get_and_update_deps() |
after -----> Fetching / Updating dependencies
|
pre_erlang_clean_compile() |
before -----> Compiling sources
|
post_erlang_clean_compile() |
after -----> Compiling sources
|
pre_relx_generate_relup() |
before -----> Generating relup to version xyz (upgrades only) |
post_relx_generate_relup() |
after -----> Generating relup to version xyz (upgrades only) |
pre_upgrade_release() |
before -----> Upgrading release to xyz (upgrades only) |
post_upgrade_release() |
after -----> Upgrading release to xyz (upgrades only) |
pre_erlang_generate_release() |
before -----> Generating release
|
post_erlang_generate_release() |
after -----> Generating release
|
pre_start_deployed_release() |
before -----> Starting deployed release
|
post_start_deployed_release() |
after -----> Starting deployed release
|
pre_extract_release_archive() |
before -----> Extracting archive xyz
|
post_extract_release_archive() |
after -----> Extracting archive xyz
|
If you want to run your task also during development, use an exrm plugin.