Skip to content

Commit b874af2

Browse files
committed
Fix bundle-install failed on gh-actions.
`--local` option of bundle-install: if an appropriate platform-specific gem exists on rubygems.org it will not be found. see: <https://bundler.io/v2.1/man/bundle-install.1.html>
1 parent f43bb6c commit b874af2

File tree

2 files changed

+30
-41
lines changed

2 files changed

+30
-41
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,42 +24,38 @@ jobs:
2424
matrix:
2525
os: [ubuntu-latest, macos-latest]
2626

27-
steps:
28-
- uses: actions/setup-ruby@v1
29-
with:
30-
ruby-version: '2.6.x'
27+
env:
28+
GEMS_PATH: ~/vendor/bundle
3129

30+
steps:
3231
- name: Checkout
3332
uses: actions/checkout@v2
3433
with:
35-
fetch-depth: 0
34+
fetch-depth: 0 # for posts's lastmod
35+
36+
- name: Setup Ruby
37+
uses: actions/setup-ruby@v1
38+
with:
39+
ruby-version: 2.6.x
3640

3741
- name: Bundle Caching
38-
id: bundle-cache
39-
uses: actions/cache@v1
42+
uses: actions/cache@v2
4043
with:
41-
path: vendor/bundle
44+
path: ${{ env.GEMS_PATH }}
4245
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }}
4346
restore-keys: |
4447
${{ runner.os }}-gems-
4548
46-
- name: Bundle config
47-
run: |
48-
bundle config path vendor/bundle
49-
5049
- name: Bundle Install
51-
if: steps.bundle-cache.outputs.cache-hit != 'true'
52-
run: |
53-
bundle install
54-
55-
- name: Bundle Install locally
56-
if: steps.bundle-cache.outputs.cache-hit == 'true'
5750
run: |
58-
bundle install --local
51+
bundle config path ${{ env.GEMS_PATH }}
52+
bundle install --jobs 4 --retry 3
5953
6054
- name: Build Site
55+
env:
56+
JEKYLL_ENV: production
6157
run: |
62-
JEKYLL_ENV=production bundle exec jekyll b
58+
bundle exec jekyll b
6359
6460
- name: Test Site
6561
run: |

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

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,40 +14,31 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
env:
17-
GEMS_PATH: /tmp/bundle
17+
GEMS_PATH: ~/vendor/bundle
1818

1919
steps:
20-
- uses: actions/setup-ruby@v1
21-
with:
22-
ruby-version: 2.6.x
23-
2420
- name: Checkout
2521
uses: actions/checkout@v2
2622
with:
27-
fetch-depth: 0
23+
fetch-depth: 0 # for posts's lastmod
24+
25+
- name: Setup Ruby
26+
uses: actions/setup-ruby@v1
27+
with:
28+
ruby-version: 2.6.x
2829

2930
- name: Bundle Caching
30-
id: bundle-cache
31-
uses: actions/cache@v1
31+
uses: actions/cache@v2
3232
with:
3333
path: ${{ env.GEMS_PATH }}
3434
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }}
3535
restore-keys: |
3636
${{ runner.os }}-gems-
3737

38-
- name: Bundle config
39-
run: |
40-
bundle config path ${{ env.GEMS_PATH }}
41-
4238
- name: Bundle Install
43-
if: steps.bundle-cache.outputs.cache-hit != 'true'
4439
run: |
45-
bundle install
46-
47-
- name: Bundle Install locally
48-
if: steps.bundle-cache.outputs.cache-hit == 'true'
49-
run: |
50-
bundle install --local
40+
bundle config path ${{ env.GEMS_PATH }}
41+
bundle install --jobs 4 --retry 3
5142

5243
- name: Check baseurl
5344
run: |
@@ -57,12 +48,14 @@ jobs:
5748
fi
5849

5950
- name: Build Site
51+
env:
52+
JEKYLL_ENV: production
6053
run: |
61-
JEKYLL_ENV=production bundle exec jekyll b
54+
bundle exec jekyll b
6255

6356
if [[ -n $SPEC_TEST ]]; then
6457
# Bypass the defects of htmlproofer
65-
JEKYLL_ENV=production bundle exec jekyll b -b "" -d "$SPEC_TEST"
58+
bundle exec jekyll b -b "" -d "$SPEC_TEST"
6659
fi
6760

6861
- name: Test Site

0 commit comments

Comments
 (0)