Skip to content

Instantly share code, notes, and snippets.

@OwenMelbz
Created August 1, 2018 13:22
Show Gist options
  • Save OwenMelbz/08c6f865149a4069644509db4f11f245 to your computer and use it in GitHub Desktop.
Save OwenMelbz/08c6f865149a4069644509db4f11f245 to your computer and use it in GitHub Desktop.
Statamic sync
#!/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 'spock@selesti.com'
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