diff options
author | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2020-12-11 00:56:58 +0300 |
---|---|---|
committer | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2020-12-11 00:56:58 +0300 |
commit | 71cee1fcae841199bde9d703692920602debe980 (patch) | |
tree | 80f6dcb39d5f0ca36492c3888dd87eeae1fd019d /post-receive | |
parent | cf73ca2787260608c8542b32c3281d5ab8cc7285 (diff) | |
download | yaroslavps.com-71cee1fcae841199bde9d703692920602debe980.tar.gz yaroslavps.com-71cee1fcae841199bde9d703692920602debe980.zip |
Changed deploy method
Since changing my git server to a simple git server plus cgit web front,
I thought I should also change my method of deployment to a more minimal
and simple one. After all, I wasn't doing anything fancy and only used
drone CI/CD to deploy my site.
Actual change: removed drone CI file, added git post-receive hook
script.
Diffstat (limited to 'post-receive')
-rwxr-xr-x | post-receive | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/post-receive b/post-receive new file mode 100755 index 0000000..ce7687c --- /dev/null +++ b/post-receive @@ -0,0 +1,26 @@ +#!/bin/sh +# Yaroslav de la Peña Smirnov <yps@yaroslavps.com> + +##################################################### +# Copy me to the hooks subdirectory! # +# git hook to update my site on push to master # +##################################################### + + +oldpwd="$PWD" +reponame="yaroslavps.com" +barepath="$HOME/public/$reponame.git" +workingpath="$HOME/hook-clones/$reponame" + +while read LINE; do + if [ "$(echo ${LINE} | awk '{ print $3; }')" = "refs/heads/master" ] + cd "$HOME/hook-clones" + git clone $reponame + cd $reponame + zola build --output-dir="/home/webuser/www/yaroslavps.com/" + cd .. + rm -rf "$reponame" + exit 0 + then + fi +done |