-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy
executable file
·54 lines (39 loc) · 1 KB
/
deploy
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# Exit if any command fails
set -e
# Variables
COMMIT=${1:-master}
TIMESTAMP=`date`
# Directory we're in
echo "In directory `pwd`"
echo "Deploying commit: $COMMIT"
# Move to repo dir
cd repo
# Update our branches from origin
git fetch origin
# Checkout the branch that is going to be deployed
git checkout $COMMIT
# rsync to move to deploy directory
rm -rf ../deploy/wp-content
rsync -az --exclude .git --exclude .gitignore ./ ../deploy/wp-content/
# Copy the ENV file if it exists
cd ../
if [ -f .env.php ]; then
cp .env.php deploy/wp-content/mu-plugins/app/
fi
# Copy the auth.json file if it exists
if [ -f auth.json ]; then
cp auth.json deploy/wp-content/auth.json
fi
# Move to deploy folder
cd deploy
cp ~/scripts/.gitignore-master .gitignore
cd wp-content/
# Build steps (composer, npm, gulp, etc)
if [ -f composer.lock ]; then
composer install -o --prefer-dist --no-progress --no-dev
fi
cd ../
git add .
git commit -am "Build release $COMMIT [$TIMESTAMP]"
git push wpengine master