webhook deploy fix

This commit is contained in:
Bachir Soussi Chiadmi 2021-05-18 14:32:46 +02:00
parent b771dd27db
commit d69c6d778a

View File

@ -56,6 +56,8 @@ if [ "$_domain" != "" ]; then
fi
done
_id=echo "$_domain" | sed "s/./_/g"
_remote=""
while [ "$_remote" = "" ]
do
@ -88,9 +90,9 @@ apt-get install webhook
git --git-dir=/home/"$user"/git-repositories/"$_domain.git" remote add origin "$_remote"
# hook deploy script
cp -f "$_assets"/webhook-deploy.sh /home/"$user"/webhook-deploy-"$_domain".sh
sed -i -r "s/DOMAIN/$_domain/g" /home/"$user"/webhook-deploy-"$_domain".sh
chmod +x /home/"$user"/webhook-deploy-"$_domain".sh
cp -f "$_assets"/webhook-deploy.sh /home/"$user"/webhook-deploy-"$_id".sh
sed -i -r "s/DOMAIN/$_id/g" /home/"$user"/webhook-deploy-"$_id".sh
chmod +x /home/"$user"/webhook-deploy-"$_id".sh
# remove git bare repos hook
mv /home/"$user"/git-repositories/"$_domain".git/hooks/post-receive /home/"$user"/git-repositories/"$_domain".git/hooks/post-receive.back
@ -98,8 +100,8 @@ mv /home/"$user"/git-repositories/"$_domain".git/hooks/post-receive /home/"$user
# webhook conf
touch /etc/webhook.conf
echo "
- id: deploy-app-$_domain
execute-command: /$user/webhook-deploy-$_domain.sh
- id: deploy_app_$_id
execute-command: /home/$user/webhook-deploy-$_id.sh
command-working-directory: /home/$user/
" >> /etc/webhook.conf
@ -113,4 +115,4 @@ systemctl restart webhook
ufw allow 9000
echo "http://$_domain:9000/hooks/deploy-app-$_domain"
echo "http://$_domain:9000/hooks/deploy_app_$_id"