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 | |
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.
-rw-r--r-- | .drone.yml | 30 | ||||
-rwxr-xr-x | post-receive | 26 |
2 files changed, 26 insertions, 30 deletions
diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 253336a..0000000 --- a/.drone.yml +++ /dev/null @@ -1,30 +0,0 @@ -kind: pipeline -type: docker -name: production - -steps: -- name: deployment - image: drillster/drone-rsync - settings: - hosts: [ "108.61.103.146" ] - port: 7822 - user: webuser - exclude: [ ".git*", ".drone.yml" ] - delete: true - recursive: true - key: - from_secret: SSH_KEY - target: /home/webuser/yaroslavps.com/ - script: - - cd ~/yaroslavps.com - - zola build --output-dir ~/www/yaroslavps.com - -trigger: - branch: - - master - event: - - push - -node: - domain: yaroslavps_com - type: docker 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 |