-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update push_docs script to for github pages
- Loading branch information
Showing
2 changed files
with
18 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |