mirror of
https://github.com/seigler/dash-docs
synced 2025-07-27 17:56:16 +00:00
Add new cron build script
This commit is contained in:
parent
b052cdf69e
commit
2ee7fee7ab
1 changed files with 35 additions and 0 deletions
35
_contrib/build_website.sh
Executable file
35
_contrib/build_website.sh
Executable file
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
|
||||
REPO='https://github.com/bitcoin/bitcoin.org.git'
|
||||
WORKDIR='/bitcoin.org'
|
||||
DESTDIR='/var/www/bitcoinorg'
|
||||
|
||||
# Stop script in case a single command fails
|
||||
set -e
|
||||
|
||||
export PATH=/var/lib/gems/1.8/bin/:$PATH
|
||||
|
||||
# Clone repository if missing
|
||||
if [ ! -d $WORKDIR ]; then
|
||||
git clone $REPO $WORKDIR
|
||||
cd $WORKDIR
|
||||
git reset --hard HEAD~1
|
||||
fi
|
||||
|
||||
cd $WORKDIR
|
||||
|
||||
# Exit if no new commit is available
|
||||
git fetch -a
|
||||
LASTLOCALCOMMIT=`git log --format="%H" | head -n1`
|
||||
LASTREMOTECOMMIT=`git log origin/master --format="%H" | head -n1`
|
||||
if [ $LASTLOCALCOMMIT == $LASTREMOTECOMMIT ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
# Update local branch
|
||||
git reset --hard origin/master
|
||||
git clean -x -f -d
|
||||
|
||||
# Build website
|
||||
jekyll
|
||||
rsync --delete -a $WORKDIR/_site/ $DESTDIR/
|
Loading…
Add table
Add a link
Reference in a new issue