-
Notifications
You must be signed in to change notification settings - Fork 0
/
post-merge
executable file
·29 lines (23 loc) · 1.07 KB
/
post-merge
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# This script should be copied to .git/hooks/ in the root of the repository on the deployment server
# It will be executed after an update to the repository has been made via git pull
HTML_PATH="/path/to/guide" # Change this to the path of the getting started guide inside the web server document root
OWNER="www-data" # Change this to the owner of the web server process
GROUP="www-data" # Change this to the group of the web server process
# path of this script
SCRIPT_PATH=$(dirname $(readlink -f $0))
# Make sure $SCRIPT_PATH ends with .git/hooks
if [[ $SCRIPT_PATH != *".git/hooks" ]]; then
echo "This script should be copied to .git/hooks/ in the root of the repository on the deployment server"
exit 1
fi
# Make sure the html path exists
if [ ! -d $HTML_PATH ]; then
echo "Error: $HTML_PATH does not exist. Please set the correct path in \$HTML_PATH variable in this script."
exit 1
fi
if [ "$GIT_PULL_FLAG" = "true" ]; then
# copy the html dir contents to the web server
cp -r $SCRIPT_PATH/../../html/* $HTML_PATH
chown -R $OWNER:$GROUP $HTML_PATH
fi