Index

joshstock.in / 8145fec

Source for serving and static templating/compiling of https://joshstock.in.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
17915 Mar 2023 16:412730e3cUpdate post-receive documenting commentJosh Stockin112G

Blob @ joshstock.in / post-receive

text/x-shellscript697 bytesdownload raw
1#!/bin/bash
2
3# this file must be placed manually at '.git/hooks/post-receive'
4
5TARGET="/home/ubuntu/joshstockin-deploy"
6GIT_DIR="/home/ubuntu/joshstockin.git"
7BRANCH="master"
8
9while read oldrev newrev ref
10do
11 if [ "$ref" = "refs/heads/$BRANCH" ];
12 then
13 echo "Ref $ref received. Deploying ${BRANCH} branch to production..."
14 mkdir $TARGET
15 git --work-tree=$TARGET --git-dir=$GIT_DIR checkout -f $BRANCH
16 echo "Running deploy script"
17 sudo $TARGET/deploy prod
18 echo "Removing deploy directory"
19 sudo rm -rf $TARGET
20 else
21 echo "Ref $ref received. Doing nothing: only the ${BRANCH} branch may be deployed on this server."
22 fi
23done
24