-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish_toghpages.sh
executable file
·36 lines (26 loc) · 1.05 KB
/
publish_toghpages.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
DIR=$(pwd)
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 "Restore changes in theme"
cd $DIR/themes/uBlogger && git restore . && cd $DIR
echo "Replacing styles from website header and title"
cd $DIR/themes/uBlogger/layouts/partials && sed -i 's/ |//' footer.html && cd $DIR
cd $DIR/themes/uBlogger/assets/css/ && sed -i "$(($(cat _ublogger.scss | grep -n post-update | cut -d':' -f1) + 1))a\ display: none;" _ublogger.scss && sed -i 's/contain/cover/' _core/_base.scss && cd $DIR
echo "Generating site"
hugo
echo "Restore changes in theme"
cd $DIR/themes/uBlogger && git restore . && cd $DIR
echo "Updating gh-pages branch"
cd public && git add --all && git commit -m "Publishing to blog.dtan13.tech" && cd ..