Skip to content

Commit 3578dcc

Browse files
committed
Fix gh-actions cache not being hit issue (cotes2020#191)
1 parent 2d23d6c commit 3578dcc

File tree

6 files changed

+129
-9
lines changed

6 files changed

+129
-9
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ jobs:
3636
- name: Setup Ruby
3737
uses: actions/setup-ruby@v1
3838
with:
39-
ruby-version: 2.6.x
39+
ruby-version: 2.7
4040

4141
- name: Bundle Caching
4242
uses: actions/cache@v2
4343
with:
4444
path: ${{ env.GEMS_PATH }}
45-
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }}
45+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
4646
restore-keys: |
4747
${{ runner.os }}-gems-
4848

.github/workflows/pages-deploy.yml.hook

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ jobs:
2525
- name: Setup Ruby
2626
uses: actions/setup-ruby@v1
2727
with:
28-
ruby-version: 2.6.x
28+
ruby-version: 2.7
2929

3030
- name: Bundle Caching
3131
uses: actions/cache@v2
3232
with:
3333
path: ${{ env.GEMS_PATH }}
34-
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }}
34+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
3535
restore-keys: |
3636
${{ runner.os }}-gems-
3737

@@ -65,7 +65,7 @@ jobs:
6565
else
6666
bash tools/test.sh
6767
fi
68-
68+
6969
- name: Deploy
7070
run: |
7171
bash tools/deploy.sh

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
.*
33
!.github
44

5-
# jekyll cache
5+
# jekyll cache
66
_site
7-
Gemfile.lock
87
vendor

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ gem "jekyll", ">= 3.8.6", "< 5.0"
66
group :jekyll_plugins do
77
gem "jekyll-paginate"
88
gem "jekyll-redirect-from"
9-
gem "jekyll-seo-tag", "~> 2.6.1"
9+
gem "jekyll-seo-tag"
1010
gem "jekyll-archives"
1111
gem "jekyll-sitemap"
1212
end
1313

1414
group :test do
15-
gem "html-proofer", "~> 3.16.0"
15+
gem "html-proofer"
1616
end
1717

1818
# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem

Gemfile.lock

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
addressable (2.7.0)
5+
public_suffix (>= 2.0.2, < 5.0)
6+
colorator (1.1.0)
7+
concurrent-ruby (1.1.7)
8+
em-websocket (0.5.2)
9+
eventmachine (>= 0.12.9)
10+
http_parser.rb (~> 0.6.0)
11+
ethon (0.12.0)
12+
ffi (>= 1.3.0)
13+
eventmachine (1.2.7)
14+
ffi (1.13.1)
15+
forwardable-extended (2.6.0)
16+
html-proofer (3.17.4)
17+
addressable (~> 2.3)
18+
mercenary (~> 0.3)
19+
nokogumbo (~> 2.0)
20+
parallel (~> 1.3)
21+
rainbow (~> 3.0)
22+
typhoeus (~> 1.3)
23+
yell (~> 2.0)
24+
http_parser.rb (0.6.0)
25+
i18n (1.8.5)
26+
concurrent-ruby (~> 1.0)
27+
jekyll (4.1.1)
28+
addressable (~> 2.4)
29+
colorator (~> 1.0)
30+
em-websocket (~> 0.5)
31+
i18n (~> 1.0)
32+
jekyll-sass-converter (~> 2.0)
33+
jekyll-watch (~> 2.0)
34+
kramdown (~> 2.1)
35+
kramdown-parser-gfm (~> 1.0)
36+
liquid (~> 4.0)
37+
mercenary (~> 0.4.0)
38+
pathutil (~> 0.9)
39+
rouge (~> 3.0)
40+
safe_yaml (~> 1.0)
41+
terminal-table (~> 1.8)
42+
jekyll-archives (2.2.1)
43+
jekyll (>= 3.6, < 5.0)
44+
jekyll-paginate (1.1.0)
45+
jekyll-redirect-from (0.16.0)
46+
jekyll (>= 3.3, < 5.0)
47+
jekyll-sass-converter (2.1.0)
48+
sassc (> 2.0.1, < 3.0)
49+
jekyll-seo-tag (2.7.1)
50+
jekyll (>= 3.8, < 5.0)
51+
jekyll-sitemap (1.4.0)
52+
jekyll (>= 3.7, < 5.0)
53+
jekyll-watch (2.2.1)
54+
listen (~> 3.0)
55+
kramdown (2.3.0)
56+
rexml
57+
kramdown-parser-gfm (1.1.0)
58+
kramdown (~> 2.0)
59+
liquid (4.0.3)
60+
listen (3.3.3)
61+
rb-fsevent (~> 0.10, >= 0.10.3)
62+
rb-inotify (~> 0.9, >= 0.9.10)
63+
mercenary (0.4.0)
64+
mini_portile2 (2.4.0)
65+
nokogiri (1.10.10)
66+
mini_portile2 (~> 2.4.0)
67+
nokogumbo (2.0.4)
68+
nokogiri (~> 1.8, >= 1.8.4)
69+
parallel (1.20.1)
70+
pathutil (0.16.2)
71+
forwardable-extended (~> 2.6)
72+
public_suffix (4.0.6)
73+
rainbow (3.0.0)
74+
rb-fsevent (0.10.4)
75+
rb-inotify (0.10.1)
76+
ffi (~> 1.0)
77+
rexml (3.2.4)
78+
rouge (3.25.0)
79+
safe_yaml (1.0.5)
80+
sassc (2.4.0)
81+
ffi (~> 1.9)
82+
terminal-table (1.8.0)
83+
unicode-display_width (~> 1.1, >= 1.1.1)
84+
thread_safe (0.3.6)
85+
typhoeus (1.4.0)
86+
ethon (>= 0.9.0)
87+
tzinfo (1.2.8)
88+
thread_safe (~> 0.1)
89+
tzinfo-data (1.2020.4)
90+
tzinfo (>= 1.0.0)
91+
unicode-display_width (1.7.0)
92+
wdm (0.1.1)
93+
yell (2.2.2)
94+
95+
PLATFORMS
96+
ruby
97+
98+
DEPENDENCIES
99+
html-proofer
100+
jekyll (>= 3.8.6, < 5.0)
101+
jekyll-archives
102+
jekyll-paginate
103+
jekyll-redirect-from
104+
jekyll-seo-tag
105+
jekyll-sitemap
106+
tzinfo (~> 1.2)
107+
tzinfo-data
108+
wdm (~> 0.1.1)
109+
110+
BUNDLED WITH
111+
2.1.4

tools/deploy.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ _no_branch=false
1515
_backup_dir="$(mktemp -d)"
1616

1717
init() {
18+
if [[ -z ${GITHUB_ACTION+x} ]]; then
19+
echo "ERROR: This script is not allowed to run outside of GitHub Action."
20+
exit -1
21+
fi
22+
23+
# Gemfile could be changed by `bundle install` in actions workflow
24+
if [[ -n $(git status Gemfile.lock --porcelain) ]]; then
25+
git checkout -- Gemfile.lock
26+
fi
27+
1828
if [[ -z $(git branch -av | grep "$PAGES_BRANCH") ]]; then
1929
_no_branch=true
2030
git checkout -b "$PAGES_BRANCH"

0 commit comments

Comments
 (0)