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

  1. #!/bin/bash
  2. #######################################################################################################
  3. # Compile and Publish Pelican website
  4. #######################################################################################################
  5. GIT="/home/git/deploy/your_repo_name/.git/" # Location of .git file in the source clone like /foo/bar/.git
  6. GITWT="/home/git/deploy/your_repo_name/" # Location of the working tree like /foo/bar
  7. pelicanRepo="/home/git/deploy/your_repo_name/" # Location of the pelican's content directory
  8. pelicanBranch="master" # Name of the git branch that trigger the publication
  9. while read oldrev newrev refname
  10. do
  11. branch=$(git rev-parse --symbolic --abbrev-ref $refname)
  12. if [ "$branch" = "${pelicanBranch}" ]; then
  13. echo "Let's go publish Pelican!"
  14. echo "##########################################################################"
  15. echo "First step: update content through git"
  16. ## Get the content with git
  17. cd ${pelicanRepo}
  18. git --git-dir=$GIT --work-tree=$GITWT checkout ${pelicanBranch}
  19. git --git-dir=$GIT --work-tree=$GITWT fetch --all
  20. git --git-dir=$GIT --work-tree=$GITWT reset --hard origin/${pelicanBranch}
  21. git --git-dir=$GIT --work-tree=$GITWT clean -f -d
  22. echo "##########################################################################"
  23. echo "Second step: publish Pelican content"
  24. echo "we use make rsync_upload so be careful to have configure your Makefile accordingly"
  25. ## Compile the content
  26. make rsync_upload
  27. echo "##########################################################################"
  28. echo "done"
  29. fi
  30. done
  31. exit 0