Skip to content

Commit

Permalink
update push_docs script to for github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
nbren12 committed May 29, 2024
1 parent 89a4af0 commit 0e31b59
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Grids currently supported:
- regular lat lon
- HealPIX

* Documentation: <https://earth-2.gitlab-master-pages.nvidia.com/earth2-grid>
* Documentation: <https://nvlabs.github.io/earth2grid>
* GitHub: <https://github.com/NVlabs/earth2grid>

## Install
Expand Down
26 changes: 17 additions & 9 deletions docs/push_docs.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 0e31b59

Please sign in to comment.