summaryrefslogtreecommitdiff
path: root/examples/olamic-run
blob: eebcfb5f418a6c1c82e1c1ed4916642fbbe4db1b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# vim: set ft=bash :

# This is an example olamic-run script for a "typical" app
# Olamic scripts are run under /bin/bash with "set -eux -o pipefail" in effect

# Variables provided by olamic
#   GIT_OBJECT  The git commit that was cloned
#   GIT_REF     The ref that triggered this run (post-receive hook)
#   GIT_REPO    The path to the git repo
#   TASK_ID     UUID for this olamic run

make
make test

if [[ $GIT_REF =~ ^refs/tags/(.+)$ ]]; then
    INSTALL_DIR=/srv/app/tag/"${BASH_REMATCH[1]}"
elif [[ $GIT_REF =~ ^refs/heads/(.+)$ ]]; then
    INSTALL_DIR=/srv/app/branch/"${BASH_REMATCH[1]}"
fi

if [[ "${INSTALL_DIR:-}" != "" ]]; then
    rm -rf "$INSTALL_DIR"
    mkdir -p "$INSTALL_DIR"
    make install PREFIX="$INSTALL_DIR"
fi