Browse Source

premier brouillon du script post-receive pour la publication automatique

master
Victor 7 years ago
parent
commit
538b34d60b
1 changed files with 33 additions and 0 deletions
  1. +33
    -0
      post-receive

+ 33
- 0
post-receive View File

@ -0,0 +1,33 @@
#!/bin/bash
#######################################################################################################
# Compile and Publish Pelican website
#######################################################################################################
GIT="/home/git/deploy/your_repo_name/" # Location of .git file in the source clone like /foo/bar/.git
GITWT="/home/git/prod/your_repo_name/" # Location of the working tree like /foo/bar
pelicanRepo="/home/git/prod/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

Loading…
Cancel
Save