Created
December 31, 2025 13:17
-
-
Save wlonkly/31b6ca979638f9dabcc64c44a86ff97c to your computer and use it in GitHub Desktop.
rich's hugo publishing stuff
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
| publish: | |
| scripts/publish.sh | |
| force-publish: | |
| scripts/publish.sh -f | |
| post title: | |
| hugo new "posts/{{title}}/index.md" | |
| code "content/posts/{{title}}/index.md" | |
| server: | |
| scripts/server.sh |
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 -eo pipefail | |
| RSYNC_CHECKSUM='--checksum' | |
| IFS=' ' | |
| GIT_STATUS=`git status --porcelain` | |
| if [[ $1 == '-f' ]]; then | |
| # upload everything even if it matches | |
| RSYNC_CHECKSUM='' | |
| elif [[ $GIT_STATUS ]]; then | |
| echo "Commit changes to git before publishing!" | |
| echo "Uncommitted changes:" | |
| echo $GIT_STATUS | |
| exit 1 | |
| fi | |
| hugo | |
| rsync -av --delete --progress $RSYNC_CHECKSUM public/ minnow.mati.ca:sites/lafferty.ca/hugo/ |
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 | |
| cleanup () { | |
| rm -f /tmp/hugo.lock | |
| } | |
| exec 100> /tmp/hugo.lock || exit 1 | |
| if ! flock -n 100; then | |
| HUGO_PID=$(pgrep -f hugo.*server) | |
| echo "hugo is already running (pid ${HUGO_PID}), exiting" | |
| exit 1 | |
| fi | |
| trap cleanup EXIT | |
| (sleep 1; open http://localhost:1313/archives) & | |
| hugo server -D -p 1313 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment