Skip to content

Commit e0df4ff

Browse files
committed
Squashed commit of the following:
commit 3b07fcc Author: Travis-CI <[email protected]> Date: Fri Jan 7 18:52:12 2022 +0000 Update critical file(s) according to Chirpy v5.0.2 commit a8cd880 Author: Travis-CI <[email protected]> Date: Tue Jan 4 19:50:28 2022 +0000 Update critical file(s) according to Chirpy v5.0.1 commit fc54bc5 Author: Cotes Chung <[email protected]> Date: Tue Jan 4 18:58:29 2022 +0800 Update the doc's link in README commit bf93d13 Author: Travis-CI <[email protected]> Date: Sun Jan 2 16:53:02 2022 +0000 Update critical file(s) according to Chirpy v5.0.0 commit 23942a9 Author: Travis-CI <[email protected]> Date: Mon Nov 29 12:35:47 2021 +0000 Update critical file(s) according to Chirpy v4.3.4 commit 66a784c Author: Travis-CI <[email protected]> Date: Sun Oct 24 20:18:05 2021 +0000 Update critical file(s) according to Chirpy v4.3.3 commit b8446c9 Author: Travis-CI <[email protected]> Date: Thu Oct 14 18:13:57 2021 +0000 Update critical file(s) according to Chirpy v4.3.2 commit 479cdc3 Author: Travis-CI <[email protected]> Date: Fri Oct 1 10:58:50 2021 +0000 Update critical file(s) according to Chirpy v4.3.1 commit ff41859 Author: Travis-CI <[email protected]> Date: Wed Sep 29 20:03:26 2021 +0000 Update critical file(s) according to Chirpy v4.3.0 commit c2a7480 Author: Cotes Chung <[email protected]> Date: Sun Sep 26 01:20:50 2021 +0800 Update README commit 4abf09e Author: Travis-CI <[email protected]> Date: Thu Sep 16 13:22:01 2021 +0000 Update critical file(s) according to Chirpy v4.2.1 commit 2327ec8 Author: Travis-CI <[email protected]> Date: Wed Sep 15 17:53:28 2021 +0000 Update critical file(s) according to Chirpy v4.2.0 commit 45ff5ba Author: Travis-CI <[email protected]> Date: Mon Aug 9 08:49:14 2021 +0000 Update critical file(s) according to Chirpy v4.1.1 commit 1d16d38 Author: Travis-CI <[email protected]> Date: Wed Jul 21 16:54:21 2021 +0000 Update critical file(s) according to Chirpy v4.1.0 commit 1a82b89 Author: Cotes Chung <[email protected]> Date: Wed Jul 21 22:33:34 2021 +0800 Update README commit d84dd10 Author: Travis-CI <[email protected]> Date: Wed Jun 23 16:55:07 2021 +0000 Update critical file(s) according to Chirpy v4.0.2 commit 14988e3 Author: Cotes Chung <[email protected]> Date: Wed Jun 23 23:26:23 2021 +0800 Update README commit 53ccb82 Author: Cotes Chung <[email protected]> Date: Fri Jun 4 19:42:36 2021 +0800 Improve the gitignore commit 81cfa31 Author: Chao Xiang <[email protected]> Date: Tue May 11 21:46:25 2021 +0800 fix usage on Customing Stylesheet commit c9806df Author: Travis-CI <[email protected]> Date: Fri May 7 19:36:50 2021 +0000 Update critical file(s) according to Chirpy v4.0.1 commit 67a9ca6 Author: Travis-CI <[email protected]> Date: Fri Apr 30 06:22:50 2021 +0000 Update critical file(s) according to Chirpy v4.0.0 commit e6b807e Author: Cotes Chung <[email protected]> Date: Fri Apr 30 14:08:12 2021 +0800 Update README to v4.0.0 commit 15f6f71 Author: Travis-CI <[email protected]> Date: Fri Apr 2 08:29:15 2021 +0000 Update critical file(s) according to Chirpy v3.3.0 commit 1d7d7cf Author: Cotes Chung <[email protected]> Date: Thu Apr 1 04:09:47 2021 +0800 Update the ruby setup in gh-actions commit dff8e09 Author: Cotes Chung <[email protected]> Date: Mon Mar 1 19:08:40 2021 +0800 Update the Gemfile commit 565ce44 Author: Cotes Chung <[email protected]> Date: Thu Feb 11 02:58:14 2021 +0800 Fix the license link in readme commit 31ed013 Author: Travis-CI <[email protected]> Date: Wed Feb 10 13:36:18 2021 +0000 [Automation] Update critical file(s) according to Chirpy v3.2.0 commit 3c4df16 Author: Cotes Chung <[email protected]> Date: Fri Feb 5 22:42:29 2021 +0800 Improve the readme commit 4bbd30d Author: Cotes Chung <[email protected]> Date: Wed Feb 3 20:12:23 2021 +0800 Update 404.html according to the theme (v3.1.0) commit 7a2365c Author: Cotes Chung <[email protected]> Date: Tue Feb 2 01:37:35 2021 +0800 Update the site config according to the theme (v3.1.0) commit 32cd311 Author: Cotes Chung <[email protected]> Date: Tue Jan 26 05:13:40 2021 +0800 Init commit
1 parent 268f5be commit e0df4ff

File tree

2 files changed

+161
-1
lines changed

2 files changed

+161
-1
lines changed

_tabs/about.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ Here are some other works that I have done for fun
2424
- [Usan Demo](https://youtu.be/Y9rJ05sL8NI).
2525

2626

27-
Feel free to explore my posts, and let's connect if you share similar interests!
27+
Feel free to explore my posts, and let's connect if you share similar interests!

tools/deploy.sh

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Build, test and then deploy the site content to 'origin/<pages_branch>'
4+
#
5+
# Requirement: html-proofer, jekyll
6+
#
7+
# Usage: See help information
8+
9+
set -eu
10+
11+
PAGES_BRANCH="gh-pages"
12+
13+
SITE_DIR="_site"
14+
15+
_opt_dry_run=false
16+
17+
_config="_config.yml"
18+
19+
_no_pages_branch=false
20+
21+
_backup_dir="$(mktemp -d)"
22+
23+
_baseurl=""
24+
25+
help() {
26+
echo "Build, test and then deploy the site content to 'origin/<pages_branch>'"
27+
echo
28+
echo "Usage:"
29+
echo
30+
echo " bash ./tools/deploy.sh [options]"
31+
echo
32+
echo "Options:"
33+
echo ' -c, --config "<config_a[,config_b[...]]>" Specify config file(s)'
34+
echo " --dry-run Build site and test, but not deploy"
35+
echo " -h, --help Print this information."
36+
}
37+
38+
init() {
39+
if [[ -z ${GITHUB_ACTION+x} && $_opt_dry_run == 'false' ]]; then
40+
echo "ERROR: It is not allowed to deploy outside of the GitHub Action envrionment."
41+
echo "Type option '-h' to see the help information."
42+
exit -1
43+
fi
44+
45+
_baseurl="$(grep '^baseurl:' _config.yml | sed "s/.*: *//;s/['\"]//g;s/#.*//")"
46+
}
47+
48+
build() {
49+
# clean up
50+
if [[ -d $SITE_DIR ]]; then
51+
rm -rf "$SITE_DIR"
52+
fi
53+
54+
# build
55+
JEKYLL_ENV=production bundle exec jekyll b -d "$SITE_DIR$_baseurl" --config "$_config"
56+
}
57+
58+
test() {
59+
bundle exec htmlproofer \
60+
--disable-external \
61+
--check-html \
62+
--allow_hash_href \
63+
"$SITE_DIR"
64+
}
65+
66+
resume_site_dir() {
67+
if [[ -n $_baseurl ]]; then
68+
# Move the site file to the regular directory '_site'
69+
mv "$SITE_DIR$_baseurl" "${SITE_DIR}-rename"
70+
rm -rf "$SITE_DIR"
71+
mv "${SITE_DIR}-rename" "$SITE_DIR"
72+
fi
73+
}
74+
75+
setup_gh() {
76+
if [[ -z $(git branch -av | grep "$PAGES_BRANCH") ]]; then
77+
_no_pages_branch=true
78+
git checkout -b "$PAGES_BRANCH"
79+
else
80+
git checkout "$PAGES_BRANCH"
81+
fi
82+
}
83+
84+
backup() {
85+
mv "$SITE_DIR"/* "$_backup_dir"
86+
mv .git "$_backup_dir"
87+
88+
# When adding custom domain from Github website,
89+
# the CANME only exist on `gh-pages` branch
90+
if [[ -f CNAME ]]; then
91+
mv CNAME "$_backup_dir"
92+
fi
93+
}
94+
95+
flush() {
96+
rm -rf ./*
97+
rm -rf .[^.] .??*
98+
99+
shopt -s dotglob nullglob
100+
mv "$_backup_dir"/* .
101+
[[ -f ".nojekyll" ]] || echo "" >".nojekyll"
102+
}
103+
104+
deploy() {
105+
git config --global user.name "GitHub Actions"
106+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
107+
108+
git update-ref -d HEAD
109+
git add -A
110+
git commit -m "[Automation] Site update No.${GITHUB_RUN_NUMBER}"
111+
112+
if $_no_pages_branch; then
113+
git push -u origin "$PAGES_BRANCH"
114+
else
115+
git push -f
116+
fi
117+
}
118+
119+
main() {
120+
init
121+
build
122+
test
123+
resume_site_dir
124+
125+
if $_opt_dry_run; then
126+
exit 0
127+
fi
128+
129+
setup_gh
130+
backup
131+
flush
132+
deploy
133+
}
134+
135+
while (($#)); do
136+
opt="$1"
137+
case $opt in
138+
-c | --config)
139+
_config="$2"
140+
shift
141+
shift
142+
;;
143+
--dry-run)
144+
# build & test, but not deploy
145+
_opt_dry_run=true
146+
shift
147+
;;
148+
-h | --help)
149+
help
150+
exit 0
151+
;;
152+
*)
153+
# unknown option
154+
help
155+
exit 1
156+
;;
157+
esac
158+
done
159+
160+
main

0 commit comments

Comments
 (0)