-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/sh | ||
|
||
DIR=$(dirname "$0") | ||
|
||
cd $DIR/.. | ||
|
||
if [[ $(git status -s) ]] | ||
then | ||
echo "The working directory is dirty. Please commit any pending changes." | ||
exit 1; | ||
fi | ||
|
||
echo "Deleting old publication" | ||
rm -rf public | ||
mkdir public | ||
git worktree prune | ||
rm -rf .git/worktrees/public/ | ||
|
||
echo "Checking out gh-pages branch into public" | ||
git worktree add -B gh-pages public origin/gh-pages | ||
|
||
echo "Removing existing files" | ||
rm -rf public/* | ||
|
||
echo "Generating site" | ||
hugo | ||
|
||
echo "Updating gh-pages branch" | ||
cd public && git add --all && git commit -m "Publishing to gh-pages" |