Skip to content

Commit ff41859

Browse files
committed
Update critical file(s) according to Chirpy v4.3.0
1 parent c2a7480 commit ff41859

File tree

9 files changed

+111
-116
lines changed

9 files changed

+111
-116
lines changed

.github/workflows/pages-deploy.yml

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,5 @@ jobs:
2525
ruby-version: 2.7
2626
bundler-cache: true
2727

28-
- name: Check baseurl
29-
run: |
30-
baseurl="$(grep '^baseurl:' _config.yml | sed "s/.*: *//;s/['\"]//g;s/#.*//")"
31-
if [[ -n $baseurl ]]; then
32-
echo "BASE_URL=$baseurl" >> $GITHUB_ENV
33-
fi
34-
35-
- name: Build Site
36-
env:
37-
JEKYLL_ENV: production
38-
run: |
39-
bundle exec jekyll b -d "_site$BASE_URL"
40-
41-
- name: Test Site
42-
run: |
43-
bash tools/test.sh
44-
4528
- name: Deploy
46-
run: |
47-
if [[ -n $BASE_URL ]]; then
48-
mv _site$BASE_URL _site-rename
49-
rm -rf _site
50-
mv _site-rename _site
51-
fi
52-
53-
bash tools/deploy.sh
29+
run: bash tools/deploy.sh

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
!.git*
44
!.editorconfig
55
!.nojekyll
6+
!.travis.yml
67

78
# bundler cache
89
_site
910
vendor
10-
Gemfile.lock
1111

1212
# rubygem
1313
*.gem

Gemfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
source "https://rubygems.org"
1+
# frozen_string_literal: true
22

3-
gem "jekyll-theme-chirpy", "~> 4.2", ">= 4.2.1"
3+
source "https://rubygems.org"
44

5-
group :jekyll_plugins do
6-
# If you have any plugins, put them here!
7-
# gem "jekyll-xxx", "~> x.y"
8-
end
5+
gem "jekyll-theme-chirpy", "~> 4.3", ">= 4.3.0"
96

107
group :test do
118
gem "html-proofer", "~> 3.18"
@@ -20,3 +17,6 @@ end
2017

2118
# Performance-booster for watching directories on Windows
2219
gem "wdm", "~> 0.1.1", :install_if => Gem.win_platform?
20+
21+
# Jekyll <= 4.2.0 compatibility with Ruby 3.0
22+
gem "webrick", "~> 1.7"

_config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# Import the theme
44
theme: jekyll-theme-chirpy
55

6-
# Only if your site type is GitHub Project sites and doesn't have a custom domain,
7-
# change below value to '/projectname'.
6+
# Change the following value to '/PROJECT_NAME' ONLY IF your site type is GitHub Pages Project sites
7+
# and doesn't have a custom domain.
88
baseurl: ''
99

1010
# The language of the webpage › http://www.lingoes.net/en/translator/langcode.htm
@@ -82,7 +82,7 @@ theme_mode: # [light|dark]
8282
img_cdn: ''
8383

8484
# the avatar on sidebar, support local or CORS resources
85-
avatar: https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/avatar.jpg
85+
avatar: ''
8686

8787
# boolean type, the global switch for ToC in posts.
8888
toc: true

_data/contact.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
-
44
type: github
5-
icon: 'fab fa-github-alt'
5+
icon: 'fab fa-github'
66
-
77
type: twitter
88
icon: 'fab fa-twitter'

_tabs/about.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: About
3-
icon: fas fa-info
3+
icon: fas fa-info-circle
44
order: 4
55
---
66

_tabs/tags.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: tags
33
title: Tags
4-
icon: fas fa-tags
4+
icon: fas fa-tag
55
order: 2
66
---

tools/deploy.sh

Lines changed: 97 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,88 @@
11
#!/usr/bin/env bash
22
#
3-
# Deploy the content of _site to 'origin/<pages_branch>'
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
48

59
set -eu
610

711
PAGES_BRANCH="gh-pages"
812

9-
_no_branch=false
13+
SITE_DIR="_site"
14+
15+
_opt_dry_run=false
16+
17+
_config="_config.yml"
18+
19+
_no_pages_branch=false
20+
1021
_backup_dir="$(mktemp -d)"
1122

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+
1238
init() {
13-
if [[ -z ${GITHUB_ACTION+x} ]]; then
14-
echo "ERROR: This script is not allowed to run outside of GitHub Action."
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."
1542
exit -1
1643
fi
1744

18-
# Gemfile could be changed by `bundle install` in actions workflow
19-
if [[ -n $(git ls-files | grep Gemfile.lock) && -n \
20-
$(git status Gemfile.lock --porcelain) ]]; then
21-
git checkout -- Gemfile.lock
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"
2272
fi
73+
}
2374

75+
setup_gh() {
2476
if [[ -z $(git branch -av | grep "$PAGES_BRANCH") ]]; then
25-
_no_branch=true
77+
_no_pages_branch=true
2678
git checkout -b "$PAGES_BRANCH"
2779
else
2880
git checkout "$PAGES_BRANCH"
2981
fi
3082
}
3183

3284
backup() {
33-
mv _site/* "$_backup_dir"
85+
mv "$SITE_DIR"/* "$_backup_dir"
3486
mv .git "$_backup_dir"
3587

3688
# When adding custom domain from Github website,
@@ -56,7 +108,7 @@ deploy() {
56108
git add -A
57109
git commit -m "[Automation] Site update No.${GITHUB_RUN_NUMBER}"
58110

59-
if $_no_branch; then
111+
if $_no_pages_branch; then
60112
git push -u origin "$PAGES_BRANCH"
61113
else
62114
git push -f
@@ -65,9 +117,43 @@ deploy() {
65117

66118
main() {
67119
init
120+
build
121+
test
122+
resume_site_dir
123+
124+
if $_opt_dry_run; then
125+
exit 0
126+
fi
127+
128+
setup_gh
68129
backup
69130
flush
70131
deploy
71132
}
72133

134+
while (($#)); do
135+
opt="$1"
136+
case $opt in
137+
-c | --config)
138+
_config="$2"
139+
shift
140+
shift
141+
;;
142+
--dry-run)
143+
# build & test, but not deploy
144+
_opt_dry_run=true
145+
shift
146+
;;
147+
-h | --help)
148+
help
149+
exit 0
150+
;;
151+
*)
152+
# unknown option
153+
help
154+
exit 1
155+
;;
156+
esac
157+
done
158+
73159
main

tools/test.sh

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)