Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 46 lines (39 sloc) 1.31 KB
set -e -f -u -o pipefail
commit_all() {
local dir="$1"
local subdir="wp-content/themes/ariane-theme"
# Check for local changes in the theme directory. We don't check for local
# changes in the wordpress directory because there will always be changes in
# the dev website, and if there are changes in the production website the code
# is explicit about which directory to automatically commit changes in.
cd "${dir}/${subdir}"
git check-local-copy-is-clean --ignore-unpushed-commits
# Sync with upstream.
git pull
git push
# Update parent repo so that backups and updates work.
cd "${dir}"
if ! git check-local-copy-is-clean 2>/dev/null; then
git add "${subdir}"
git commit -m 'Updated ariane-theme.'
main() {
if [[ "$#" -eq 0 ]]; then
# Update dev.
commit_all "${HOME}/"
# Update www.
ssh -o ControlMaster=no arianetobin@hosting \
"${HOME}/bin/update-ariane-theme" argument_just_to_trigger_other_branch
# Clear mod_pagespeed cache to ensure consistency, e.g. correct style.css
# being used.
printf "Clearing mod_pagespeed cache\\n"
sudo touch /var/cache/mod_pagespeed/cache.flush
# This is being run over ssh as arianetobin.
commit_all "${HOME}/"
main "$@"