diff options
| author | la-ninpre <leobrekalini@gmail.com> | 2021-08-19 10:55:05 +0300 |
|---|---|---|
| committer | la-ninpre <leobrekalini@gmail.com> | 2021-08-19 10:55:05 +0300 |
| commit | 7ac5dbeb4f9329dbd75e42c800b8afc8b58d552d (patch) | |
| tree | 06ba313ab5f5f7c1b8b083718ffbd9a27cdf2977 /post-receive.example | |
| parent | 86fab0396f6a76f373d04f81a490aed025c0b856 (diff) | |
| download | aaoth.xyz-7ac5dbeb4f9329dbd75e42c800b8afc8b58d552d.tar.gz aaoth.xyz-7ac5dbeb4f9329dbd75e42c800b8afc8b58d552d.zip | |
add example post-receive hook
Diffstat (limited to 'post-receive.example')
| -rw-r--r-- | post-receive.example | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/post-receive.example b/post-receive.example new file mode 100644 index 0000000..7d5c48c --- /dev/null +++ b/post-receive.example @@ -0,0 +1,31 @@ +#!/bin/sh + +# example git post-receive hook that i use to autobuild my website on push + +# setup paths +export GEM_HOME=$HOME/gems +export PATH=$GEM_HOME/bin:$PATH + +# set variables, change example.com to your website repo name +GIT_REPO=$HOME/example.com.git +TMP_GIT_CLONE=$HOME/tmp/example.com +GEMFILE=$TMP_GIT_CLONE/Gemfile +PUBLIC_WWW=/var/www/htdocs/example.com + +# change branch name to your main deploy branch +git clone -b main "$GIT_REPO" "$TMP_GIT_CLONE" + +# build the site +BUNDLE_GEMFILE=$GEMFILE bundle install +BUNDLE_GEMFILE=$GEMFILE bundle exec jekyll build -s "$TMP_GIT_CLONE" -d "$PUBLIC_WWW" + +# genterate thumbnails +{ + cp "$TMP_GIT_CLONE/art/thumbs.sh" "$PUBLIC_WWW/art/thumbs.sh" + cd "$PUBLIC_WWW/art" + sh thumbs.sh + rm thumbs.sh +} + +rm -Rf "$TMP_GIT_CLONE" +exit |
