From f832e249164ff5803e8364efbe91ab190be0e6a1 Mon Sep 17 00:00:00 2001 From: punk Date: Sat, 24 Apr 2021 19:35:03 +0100 Subject: tools/gitolite hooks transition from bash to sh --- tools/conf/srv/gitolite/deploy-web | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 tools/conf/srv/gitolite/deploy-web (limited to 'tools/conf/srv/gitolite/deploy-web') diff --git a/tools/conf/srv/gitolite/deploy-web b/tools/conf/srv/gitolite/deploy-web new file mode 100755 index 0000000..aa4a7fa --- /dev/null +++ b/tools/conf/srv/gitolite/deploy-web @@ -0,0 +1,45 @@ +#!/bin/sh + +###################################################################### +# +# Put this file in your gitolite-admin; +# ~/gitolite-admin/local/hooks/repo-specific/deploy-web +# +# set host to empty to create package for each push +# or set remote host to create package based on last deployed push +# host="https://doc.localhost" +host="" +# set name of witch branch should be deployed +branch_to_deploy="master" + +###################################################################### + + +url="$host/.last_deploy" + +. /srv/gitolite/deploy/hook.sh + +read oldrev newrev refname +push_branch=$(git rev-parse --symbolic --abbrev-ref $refname) + +SCRIPT_VARS=$(set) +#echo "project: $PROJECT" +#echo "local dir: $PWD : /srv/gitolite/deploy/${GL_REPO}" +#echo "${SCRIPT_VARS} : /srv/gitolite/deploy/${GL_REPO}" + +if [[ $push_branch = $branch_to_deploy ]]; then + + # if host empty we make local tracking + if [[ $host = "" ]]; then + if [[ $(is_initial ${GL_REPO}) = "true" ]]; then + oldrev="initial" + fi + else + if [[ ! $(valid_url $url) = "true" ]]; then + echo "Deploy: set $url on remote to start creating packages" + exit 1 + fi + oldrev=$(get_remote_rev $url) + fi + create_package ${GL_REPO} ${PWD} ${oldrev} ${newrev} "deploy-web.sh" +fi -- cgit 1.4.1-2-gfad0