git deploy gitdeploy with gitdeploy

This commit is contained in:
AJ ONeal 2020-10-09 09:37:02 +00:00
parent 6cd5581ca6
commit 625ebdb8ed
1 changed files with 21 additions and 0 deletions

View File

@ -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