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

kainlite/blog

Repository files navigation

Build and update live site

hugo -d ~/Webs/kainlite.github.io
c kainlite.github.io
gadd && gc -m "Message" && ggpush

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

Deploy

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.

Deprecated

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.

#!/bin/bash

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

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

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