-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwpengine-deployment.sh
More file actions
46 lines (31 loc) · 1.12 KB
/
wpengine-deployment.sh
File metadata and controls
46 lines (31 loc) · 1.12 KB
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
#!/bin/bash -e
#
# Deploy your branch on WPEngine.
# This was inpired by WP VIP Go deploy script for Travis CI and Circle.
# Modified by connor@mayvendev.com to make WPEngine deployments easier without having to clog repos with compiled files.
#
set -ex
if [[ -d "$BUILD_DIR" ]]; then
echo "ERROR: ${BUILD_DIR} already exists."
echo "This should not happen."
exit 1
fi
echo "Deploying ${BRANCH}"
# Making the directory we're going to sync the build into
git clone "${REPO_SSH_URL}" "${BUILD_DIR}"
cd $RELEASE_DIR
# Copy the files over
# -------------------
echo "Syncing files... quietly"
rsync -a --quiet --delete --stats --exclude "themes/${THEME_NAME}/.gitignore" --exclude "themes/${THEME_NAME}/node_modules" "${RELEASE_DIR}/wp-content/" "${BUILD_DIR}/wp-content/"
# Add changed files, delete deleted, etc, etc, you know the drill
cd ${BUILD_DIR}
git add -A .
if [ -z "$(git status --porcelain)" ]; then
echo "NOTICE: No changes to deploy"
exit 0
fi
# Commit it.
git commit -a -m "Commit ${COMMIT_SHA} from mayvendev.com repo for ${THEME_NAME} at $(date +%s)"
# Push it (push it real good).
git push origin "${DEPLOY_BRANCH}"