summaryrefslogtreecommitdiff
path: root/post-receive
blob: afbe28e7358a025e25c31c5cf63fe4211dc59c51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
set -e
GITDIR="$(pwd)"
BUILDDIR="/tmp/build_www_$(date +%s)"
BRANCH=$(cat | sed -e "s/[a-z0-9]* [a-z0-9]* refs\/heads\/\(.*\)/\1/g")
if test "$BRANCH" != "master"; then
	exit 0
fi
echo "Deploying ..."
git clone --recurse-submodules -q $GITDIR $BUILDDIR
cd $BUILDDIR
cd projs/
yarn install
yarn build
sed -i '' "s/\/assets/assets/g" dist/index.html
mv dist/ ../
cd ..
rm -rf projs
mv dist projs
cd $GITDIR
rsync -r --delete $BUILDDIR/ /usr/local/www/index/
rm -rf $BUILDDIR