Last active
December 22, 2019 13:46
-
-
Save sople1/c2f4cba053bddd5def1e4822381020b8 to your computer and use it in GitHub Desktop.
GIT: update data on post-update (local, remote)
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 | |
| # | |
| # .git/post-update | |
| # | |
| git update-server-info | |
| echo "Starting Updating Process..." | |
| # :: Auto-Pulling script > | |
| #SERVICE_WEB_ROOT="/var/www/html/" | |
| SERVICE_WEB_ROOT="($PUBLICHOME_PATH)" | |
| SERVICE_DEV_ROOT="($DEVHOME_PATH)" | |
| SSH_CONN_WEB="user@localhost" | |
| SSH_CONN_DEV="user@localhost" | |
| SSH_ORDER_WEB="cd $SERVICE_WEB_ROOT && git pull origin" | |
| SSH_ORDER_DEV="cd $SERVICE_DEV_ROOT && git pull origin" | |
| # -- Push to DEV when all Pushes are launched | |
| echo "Push to DEV>>" | |
| ssh $SSH_CONN_DEV $SERVICE_DEV_ROOT $SSH_ORDER_DEV | |
| ## switch by branch | |
| branch=$(git rev-parse --symbolic --abbrev-ref $1) # $1=refname | |
| if [ "master"=="$branch" ]; then | |
| # -- Push to WEB when Pushed branch was 'master' | |
| echo "Push to WEB>>" | |
| ssh $SSH_CONN_WEB $SERVICE_WEB_ROOT $SSH_ORDER_WEB | |
| else | |
| echo "None updated" | |
| fi | |
| # echo $branch | |
| # switch by branch > end | |
| echo "Updating Process Completed." | |
| # :: Auto-Pulling script > end | |
| exec |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment