From 625ebdb8ed18c314787d591d85bf4bbccdec40c6 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 9 Oct 2020 09:37:02 +0000 Subject: [PATCH] git deploy gitdeploy with gitdeploy --- .../root/gitdeploy/deploy.sh | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 examples/git.rootprojects.org/root/gitdeploy/deploy.sh diff --git a/examples/git.rootprojects.org/root/gitdeploy/deploy.sh b/examples/git.rootprojects.org/root/gitdeploy/deploy.sh new file mode 100644 index 0000000..7b22b69 --- /dev/null +++ b/examples/git.rootprojects.org/root/gitdeploy/deploy.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -u + +if [[ "${GIT_REF_NAME}" != "master" ]] +then + echo "Nothing to do for ${GIT_REPO_ID}#${GIT_REF_NAME}" + exit 0 +fi + +echo "Deploying ${GIT_REPO_ID}#${GIT_REF_NAME} ..." + +my_tmp="$(mktemp -d -t "tmp.XXXXXXXXXX")" +git clone "${GIT_CLONE_URL}" "${my_tmp}/${GIT_REPO_NAME}" +pushd "${my_tmp}/${GIT_REPO_NAME}/" + go generate -mod=vendor ./... + go build -mod=vendor . + mkdir -p ~/.local/bin/ + rsync -av ./gitdeploy ~/.local/bin/ + + sudo systemctl restart gitdeploy +popd