Skip to content

Instantly share code, notes, and snippets.

@simonrenger
Created November 18, 2019 17:35
Show Gist options
  • Save simonrenger/3243c1d0176ac2fed5aeb5479b8dddda to your computer and use it in GitHub Desktop.
Save simonrenger/3243c1d0176ac2fed5aeb5479b8dddda to your computer and use it in GitHub Desktop.
Pull & Build a hugo repositry and move to destination
#!/bin/bash
# Author: Simon Renger <[email protected]>
# This script will pull and build your Hugo website from a git server and then build it and move to the correct location.
# Simple usage:$ sh pb_hugo.sh <reponame> <folder name> <move location>
# example: sh pb_hugo.sh https://gitserver.tld/user/my-blog.git my-blog /home/user/www/
if [ ! -d $2 ]
then
echo "Clone repo and build"
git clone $1 $2 && cd $2 && hugo && mv public $3
else
echo "pull and build hugo website and move to dest"
cd $2 && git pull && hugo && mv public $3
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment