#!/bin/bash
DOMAIN=[domain-name]
GIT_REPO=/var/repos/[repo-name].repo.git
WORKING_DIRECTORY=/tmp/$DOMAIN
PUBLIC_WWW=/var/www/$DOMAIN
BACKUP_WWW=/tmp/$DOMAIN-backup
set -e
rm -rf $WORKING_DIRECTORY
rsync -aqz $PUBLIC_WWW/ $BACKUP_WWW
trap "echo 'A problem occurred. Reverting to backup.'; rsync -aqz --del $BACKUP_WWW/ $PUBLIC_WWW; r
m -rf $WORKING_DIRECTORY" EXIT
git clone $GIT_REPO $WORKING_DIRECTORY
git clone https://github.com/[them] $WORKING_DIRECTORY/themes/beautifulhugo
# The following section should be changed to use rsync so that it nicely updates
# the directory instead of making it blank.
rm -rf $PUBLIC_WWW/*
hugo -s $WORKING_DIRECTORY -d $PUBLIC_WWW -b "http://${DOMAIN}"
rm -rf $WORKING_DIRECTORY
Merge a hot fix from Master back into Dev branch
Taken from Stack Overflow https://stackoverflow.com/questions/7175869/managing-hotfixes-when-develop-branch-is-very-different-from-master
Take all commits to master and merge them back in to development
git checkout devel
git rebase master
How to change your git commit date after the facts
Change lastmod for Hugo when lastmod is based on git commit
stackoverflow - re-write git commit time
git filter-branch -f --env-filter \
'if [ $GIT_COMMIT = 9fb407b47803c201725fd02c1a7406c93e5cad42 ]
then
export GIT_AUTHOR_DATE="Sun May 10 00:00:00 2020 +0900"
export GIT_COMMITTER_DATE="Sun May 10 01:00:00 2020 +0900"
fi'
Don’t forget to use –force when pushing upstream.
Push to GitHub Triggers Push to Remote
Auto Update Site from a Git Push
Pushing directly from Dev Server to Remote Production Server
Hi,
For a little while now I have been thinking about moving my personal blog to a self-hosted service. One of the options I have been considering is Linode.
As part of this idea. I wanted to see how I might be able to automate some of the processes. This is just a write up on one of my ideas so far.
[Read More]