-
-
Save yu1ec/eb416642ead5e2d1abd2a4b9321b831a to your computer and use it in GitHub Desktop.
Git post-commit hook for: auto-push to jenkins + auto backup
This file contains 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/sh | |
# Backup | |
git ls-remote backup --quiet | |
if test $? = 0; | |
then | |
git push backup --force --all --quiet | |
echo "...Backuped" | |
else | |
echo "No Backup repository => Skip backup" | |
fi | |
# Push to jenkins if master branch | |
if [[ `git symbolic-ref HEAD` == "refs/heads/master" ]] | |
then | |
echo "Auto Pushing 'jenkins' branch to Jenkins server..." | |
git push jenkins jenkins --quiet | |
fi | |
# Push to jenkins if master branch | |
if [[ `git symbolic-ref HEAD` == "refs/heads/jenkins" ]] | |
then | |
echo "Auto Pushing 'master' branch to Jenkins server..." | |
git push jenkins jenkins --quiet | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment