From 0e31b59027c6b90b73be8905c54e8b12ca9ca5ce Mon Sep 17 00:00:00 2001 From: "Noah D. Brenowitz" Date: Wed, 29 May 2024 11:38:21 -0700 Subject: [PATCH] update push_docs script to for github pages --- README.md | 2 +- docs/push_docs.sh | 26 +++++++++++++++++--------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 08fce59..9dbea46 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Grids currently supported: - regular lat lon - HealPIX -* Documentation: +* Documentation: * GitHub: ## Install diff --git a/docs/push_docs.sh b/docs/push_docs.sh index 251efc4..9441892 100755 --- a/docs/push_docs.sh +++ b/docs/push_docs.sh @@ -1,14 +1,22 @@ #!/bin/bash +set -ex + +make docs + originalBranch=$(git rev-parse --abbrev-ref HEAD) # Function to switch back to the original branch -function switchBack { - echo "Switching back to $originalBranch" - git checkout $originalBranch +function cleanup { + echo "Cleaning up worktree" + git worktree remove --force /tmp/earth2grid-pages } -git checkout pages -trap switchBack EXIT -rm -r public/ && cp -r docs/_build/html public -git add -f public/ -git commit -a -m "update doc from $ref" -git push origin pages +git worktree add pages /tmp/earth2grid-pages +trap cleanup EXIT + +rsync -av --delete --exclude ".git" docs/_build/html/ /tmp/earth2grid-pages/ +touch /tmp/earth2grid-pages/.nojekyll + +cd /tmp/earth2grid-pages +git add -A +git commit -m "update doc from $ref" +echo "To update the website: git push origin pages"