Created
August 1, 2018 13:22
-
-
Save OwenMelbz/08c6f865149a4069644509db4f11f245 to your computer and use it in GitHub Desktop.
Statamic sync
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 | |
# This folder page could change between environments - careful! | |
env=$1 | |
if [[ $env == "prod" ]]; then | |
cd /home/forge/www.selesti.com | |
else | |
cd /home/forge/pink.selesti.com | |
fi | |
if git diff-index --quiet HEAD --; then | |
echo 'No file changes found - no need to commit' | |
git pull | |
if [[ $(git status) == *"branch is ahead"* ]]; then | |
echo 'Unpushed commits found - now pushing' | |
git push | |
fi | |
else | |
echo 'Found uncommited changes - commiting and pushing now' | |
node ./scripts/optimise-images.js | |
git config user.email '[email protected]' | |
git config user.name 'Spock' | |
git add . | |
git commit -m "Automatic Revision Collected" | |
git pull | |
git push | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment