Created
June 12, 2017 15:57
-
-
Save naimkhalifa/8863a6202b0c010f9a547a5c4f79b92b to your computer and use it in GitHub Desktop.
Simple git post-receive hook for OVH shared hosting config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
working_dir_base="/homez.172/nomdutilisateur/www/_sites/monsite.git" | |
while read oldrev newrev refname | |
do | |
branch=$(git rev-parse --symbolic --abbrev-ref $refname) | |
echo "Starting deployment..." | |
GIT_WORK_TREE=$working_dir_base git checkout $branch -f | |
NOW=$(date +"%Y%m%d-%H%M") | |
git tag release_$NOW $branch | |
echo " /===============================" | |
echo " | Target branch: $branch" | |
echo " | Target folder: $working_dir_base" | |
echo " \==============================" | |
echo "done !" | |
done | |
#more info at http://www.codeur.co/configurer-git-pour-d%C3%A9ployer-sur-un-mutualis%C3%A9-ovh (fr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment