Le blog de Victor Héry
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

33 lines
1.7 KiB

#!/bin/bash
#######################################################################################################
# Compile and Publish Pelican website
#######################################################################################################
GIT="/home/git/deploy/your_repo_name/.git/" # Location of .git file in the source clone like /foo/bar/.git
GITWT="/home/git/deploy/your_repo_name/" # Location of the working tree like /foo/bar
pelicanRepo="/home/git/deploy/your_repo_name/" # Location of the pelican's content directory
pelicanBranch="master" # Name of the git branch that trigger the publication
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ "$branch" = "${pelicanBranch}" ]; then
echo "Let's go publish Pelican!"
echo "##########################################################################"
echo "First step: update content through git"
## Get the content with git
cd ${pelicanRepo}
git --git-dir=$GIT --work-tree=$GITWT checkout ${pelicanBranch}
git --git-dir=$GIT --work-tree=$GITWT fetch --all
git --git-dir=$GIT --work-tree=$GITWT reset --hard origin/${pelicanBranch}
git --git-dir=$GIT --work-tree=$GITWT clean -f -d
echo "##########################################################################"
echo "Second step: publish Pelican content"
echo "we use make rsync_upload so be careful to have configure your Makefile accordingly"
## Compile the content
make rsync_upload
echo "##########################################################################"
echo "done"
fi
done
exit 0