Skip to content

Commit db073be

Browse files
author
Hamed
committed
add auto publish script
1 parent 6378272 commit db073be

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

publish_to_ghpages.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
#!/bin/sh
3+
4+
echo "Deleting old publication"
5+
rm -rf public
6+
mkdir public
7+
git worktree prune
8+
rm -rf .git/worktrees/public/
9+
10+
echo "Checking out gh-pages branch into public"
11+
git worktree add -B gh-pages public origin/gh-pages
12+
13+
echo "Removing existing files"
14+
rm -rf public/*
15+
16+
echo "Generating site"
17+
hugo
18+
19+
echo "Updating gh-pages branch"
20+
cd public && git add --all && git commit -m "Publishing to gh-pages"
21+
22+
echo "Pushing changes"
23+
git push origin gh-pages

0 commit comments

Comments
 (0)