From 84aa863b5a5f1e8b441605e653b4cf5c54829d9a Mon Sep 17 00:00:00 2001 From: Fabrice Salvaire Date: Sat, 22 Dec 2018 20:58:07 +0100 Subject: [PATCH] added ghpages --- gh-pages/README.rst | 3 ++ gh-pages/html-rsync-filter.txt | 7 +++++ gh-pages/update-gh-pages | 55 ++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 gh-pages/README.rst create mode 100644 gh-pages/html-rsync-filter.txt create mode 100755 gh-pages/update-gh-pages diff --git a/gh-pages/README.rst b/gh-pages/README.rst new file mode 100644 index 0000000..1a05d47 --- /dev/null +++ b/gh-pages/README.rst @@ -0,0 +1,3 @@ +This branch contains the GitHub Pages for PythonicGCodeMachine. + +These pages are generated by the documentation tool. diff --git a/gh-pages/html-rsync-filter.txt b/gh-pages/html-rsync-filter.txt new file mode 100644 index 0000000..97ec06b --- /dev/null +++ b/gh-pages/html-rsync-filter.txt @@ -0,0 +1,7 @@ +.buildinfo +.git +.gitignore +README.rst +push-to-github.sh +html-rsync-filter.txt +update.sh diff --git a/gh-pages/update-gh-pages b/gh-pages/update-gh-pages new file mode 100755 index 0000000..4c9e033 --- /dev/null +++ b/gh-pages/update-gh-pages @@ -0,0 +1,55 @@ +#! /bin/bash + +#################################################################################################### + +root_dir=$(dirname $(dirname $(realpath $0))) +html_build="${root_dir}/doc/sphinx/build/html" +source_gh_pages=${root_dir}/gh-pages + +echo Source Path: ${root_dir} +echo HTML Build Path: ${html_build} + +origin='git@github.com:FabriceSalvaire/PythonicGCodeMachine.git' + +#################################################################################################### + +tmp_dir=$(mktemp -d) +if [ -e ${tmp_dir} ]; then + pushd ${tmp_dir} + + # To create gh-pages branch + # git clone ${origin} PythonicGCodeMachine-gh-pages + # pushd PythonicGCodeMachine-gh-pages + # git checkout --orphan gh-pages + # git rm --cached -r . + + git clone ${origin} PythonicGCodeMachine-gh-pages --branch gh-pages --single-branch + pushd PythonicGCodeMachine-gh-pages + # sync with origin if already cloned + # git fetch origin + git checkout gh-pages + + rm -rf static images + rsync --delete -av --exclude-from=${source_gh_pages}/html-rsync-filter.txt ${html_build}/ . + cp ${source_gh_pages}/README.rst . + if [ -e _images ]; then + mv _images images + find . -name "*.html" -exec sed -e 's/_images/images/g;' -i {} \; + fi + if [ -e _static ]; then + mv _static static + find . -name "*.html" -exec sed -e 's/_static/static/g;' -i {} \; + fi + if [ -e _downloads ]; then + mv _downloads downloads + find . -name "*.html" -exec sed -e 's/_downloads/downloads/g;' -i {} \; + fi + find . -name '.#*html' -exec rm {} \; + + git add --all * + git commit -m 'update' + git push -u origin gh-pages + + popd -1 ; popd + rm -rf ${tmp_dir} +fi -- GitLab