Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.


Repository files navigation

Build and update live site

hugo -d ~/Webs/
gadd && gc -m "Message" && ggpush

If those fancy aliases looks like something you might like to have check my dotfiles and oh-my-zsh :)


Published using github actions see more at .github/workflows/main.yml, previously I was a git hook and that worked fine, but it's easy to have that done automatically in a remote runner instead of a local machine.


This handy pre-push hook will push the changes automatically when pushing to this repo with the same commit message. Save as .git/hooks/pre-push and give it +x permissions to it.


COMMIT_MESSAGE=`git log -n 1 --pretty=format:%s ${local_ref}`

hugo -d ~/Webs/
ANYTHING_CHANGED=`cd ~/Webs/ && git diff --exit-code`
if [[ $? -gt 0 ]]; then
    cd ~/Webs/ && git add . && git commit -m "${COMMIT_MESSAGE}" && git push origin master

This way we don't have to do anything manually in the other repo but to commit the proper changes here.