Fix gh-actions cache not being hit issue (#191)

This commit is contained in:
Cotes Chung 2020-12-06 23:12:20 +08:00
parent cbf707dc56
commit 8d4c555638
6 changed files with 129 additions and 9 deletions

View file

@ -36,13 +36,13 @@ jobs:
- name: Setup Ruby - name: Setup Ruby
uses: actions/setup-ruby@v1 uses: actions/setup-ruby@v1
with: with:
ruby-version: 2.6.x ruby-version: 2.7
- name: Bundle Caching - name: Bundle Caching
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: ${{ env.GEMS_PATH }} path: ${{ env.GEMS_PATH }}
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }} key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: | restore-keys: |
${{ runner.os }}-gems- ${{ runner.os }}-gems-

View file

@ -25,13 +25,13 @@ jobs:
- name: Setup Ruby - name: Setup Ruby
uses: actions/setup-ruby@v1 uses: actions/setup-ruby@v1
with: with:
ruby-version: 2.6.x ruby-version: 2.7
- name: Bundle Caching - name: Bundle Caching
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: ${{ env.GEMS_PATH }} path: ${{ env.GEMS_PATH }}
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }} key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: | restore-keys: |
${{ runner.os }}-gems- ${{ runner.os }}-gems-
@ -65,7 +65,7 @@ jobs:
else else
bash tools/test.sh bash tools/test.sh
fi fi
- name: Deploy - name: Deploy
run: | run: |
bash tools/deploy.sh bash tools/deploy.sh

3
.gitignore vendored
View file

@ -2,7 +2,6 @@
.* .*
!.github !.github
# jekyll cache # jekyll cache
_site _site
Gemfile.lock
vendor vendor

View file

@ -6,13 +6,13 @@ gem "jekyll", ">= 3.8.6", "< 5.0"
group :jekyll_plugins do group :jekyll_plugins do
gem "jekyll-paginate" gem "jekyll-paginate"
gem "jekyll-redirect-from" gem "jekyll-redirect-from"
gem "jekyll-seo-tag", "~> 2.6.1" gem "jekyll-seo-tag"
gem "jekyll-archives" gem "jekyll-archives"
gem "jekyll-sitemap" gem "jekyll-sitemap"
end end
group :test do group :test do
gem "html-proofer", "~> 3.16.0" gem "html-proofer"
end end
# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem # Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem

111
Gemfile.lock Normal file
View file

@ -0,0 +1,111 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
colorator (1.1.0)
concurrent-ruby (1.1.7)
em-websocket (0.5.2)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
ethon (0.12.0)
ffi (>= 1.3.0)
eventmachine (1.2.7)
ffi (1.13.1)
forwardable-extended (2.6.0)
html-proofer (3.17.4)
addressable (~> 2.3)
mercenary (~> 0.3)
nokogumbo (~> 2.0)
parallel (~> 1.3)
rainbow (~> 3.0)
typhoeus (~> 1.3)
yell (~> 2.0)
http_parser.rb (0.6.0)
i18n (1.8.5)
concurrent-ruby (~> 1.0)
jekyll (4.1.1)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (~> 1.0)
jekyll-sass-converter (~> 2.0)
jekyll-watch (~> 2.0)
kramdown (~> 2.1)
kramdown-parser-gfm (~> 1.0)
liquid (~> 4.0)
mercenary (~> 0.4.0)
pathutil (~> 0.9)
rouge (~> 3.0)
safe_yaml (~> 1.0)
terminal-table (~> 1.8)
jekyll-archives (2.2.1)
jekyll (>= 3.6, < 5.0)
jekyll-paginate (1.1.0)
jekyll-redirect-from (0.16.0)
jekyll (>= 3.3, < 5.0)
jekyll-sass-converter (2.1.0)
sassc (> 2.0.1, < 3.0)
jekyll-seo-tag (2.7.1)
jekyll (>= 3.8, < 5.0)
jekyll-sitemap (1.4.0)
jekyll (>= 3.7, < 5.0)
jekyll-watch (2.2.1)
listen (~> 3.0)
kramdown (2.3.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.3)
listen (3.3.3)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
mini_portile2 (2.4.0)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
nokogumbo (2.0.4)
nokogiri (~> 1.8, >= 1.8.4)
parallel (1.20.1)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (4.0.6)
rainbow (3.0.0)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.4)
rouge (3.25.0)
safe_yaml (1.0.5)
sassc (2.4.0)
ffi (~> 1.9)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thread_safe (0.3.6)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (1.2.8)
thread_safe (~> 0.1)
tzinfo-data (1.2020.4)
tzinfo (>= 1.0.0)
unicode-display_width (1.7.0)
wdm (0.1.1)
yell (2.2.2)
PLATFORMS
ruby
DEPENDENCIES
html-proofer
jekyll (>= 3.8.6, < 5.0)
jekyll-archives
jekyll-paginate
jekyll-redirect-from
jekyll-seo-tag
jekyll-sitemap
tzinfo (~> 1.2)
tzinfo-data
wdm (~> 0.1.1)
BUNDLED WITH
2.1.4

View file

@ -15,6 +15,16 @@ _no_branch=false
_backup_dir="$(mktemp -d)" _backup_dir="$(mktemp -d)"
init() { init() {
if [[ -z ${GITHUB_ACTION+x} ]]; then
echo "ERROR: This script is not allowed to run outside of GitHub Action."
exit -1
fi
# Gemfile could be changed by `bundle install` in actions workflow
if [[ -n $(git status Gemfile.lock --porcelain) ]]; then
git checkout -- Gemfile.lock
fi
if [[ -z $(git branch -av | grep "$PAGES_BRANCH") ]]; then if [[ -z $(git branch -av | grep "$PAGES_BRANCH") ]]; then
_no_branch=true _no_branch=true
git checkout -b "$PAGES_BRANCH" git checkout -b "$PAGES_BRANCH"