From 3e2d71d7b135cc6980cc10a4108130236734551e Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Fri, 30 Oct 2020 16:04:16 -0700 Subject: Initial version. --- examples/olamic-run | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 examples/olamic-run (limited to 'examples/olamic-run') diff --git a/examples/olamic-run b/examples/olamic-run new file mode 100644 index 0000000..eebcfb5 --- /dev/null +++ b/examples/olamic-run @@ -0,0 +1,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 -- cgit v1.2.3