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>
This commit is contained in:
Cotes Chung 2020-11-23 01:26:29 +08:00
parent a5b002b2d8
commit b985965bc9
2 changed files with 30 additions and 41 deletions

View file

@ -24,42 +24,38 @@ jobs:
matrix: matrix:
os: [ubuntu-latest, macos-latest] os: [ubuntu-latest, macos-latest]
steps: env:
- uses: actions/setup-ruby@v1 GEMS_PATH: ~/vendor/bundle
with:
ruby-version: '2.6.x'
steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0 # for posts's lastmod
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Bundle Caching - name: Bundle Caching
id: bundle-cache uses: actions/cache@v2
uses: actions/cache@v1
with: with:
path: vendor/bundle path: ${{ env.GEMS_PATH }}
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }} key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }}
restore-keys: | restore-keys: |
${{ runner.os }}-gems- ${{ runner.os }}-gems-
- name: Bundle config
run: |
bundle config path vendor/bundle
- name: Bundle Install - name: Bundle Install
if: steps.bundle-cache.outputs.cache-hit != 'true'
run: | run: |
bundle install bundle config path ${{ env.GEMS_PATH }}
bundle install --jobs 4 --retry 3
- name: Bundle Install locally
if: steps.bundle-cache.outputs.cache-hit == 'true'
run: |
bundle install --local
- name: Build Site - name: Build Site
env:
JEKYLL_ENV: production
run: | run: |
JEKYLL_ENV=production bundle exec jekyll b bundle exec jekyll b
- name: Test Site - name: Test Site
run: | run: |

View file

@ -14,40 +14,31 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
GEMS_PATH: /tmp/bundle GEMS_PATH: ~/vendor/bundle
steps: steps:
- uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0 # for posts's lastmod
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Bundle Caching - name: Bundle Caching
id: bundle-cache uses: actions/cache@v2
uses: actions/cache@v1
with: with:
path: ${{ env.GEMS_PATH }} path: ${{ env.GEMS_PATH }}
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }} key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }}
restore-keys: | restore-keys: |
${{ runner.os }}-gems- ${{ runner.os }}-gems-
- name: Bundle config - name: Bundle Install
run: | run: |
bundle config path ${{ env.GEMS_PATH }} bundle config path ${{ env.GEMS_PATH }}
bundle install --jobs 4 --retry 3
- name: Bundle Install
if: steps.bundle-cache.outputs.cache-hit != 'true'
run: |
bundle install
- name: Bundle Install locally
if: steps.bundle-cache.outputs.cache-hit == 'true'
run: |
bundle install --local
- name: Check baseurl - name: Check baseurl
run: | run: |
@ -57,12 +48,14 @@ jobs:
fi fi
- name: Build Site - name: Build Site
env:
JEKYLL_ENV: production
run: | run: |
JEKYLL_ENV=production bundle exec jekyll b bundle exec jekyll b
if [[ -n $SPEC_TEST ]]; then if [[ -n $SPEC_TEST ]]; then
# Bypass the defects of htmlproofer # Bypass the defects of htmlproofer
JEKYLL_ENV=production bundle exec jekyll b -b "" -d "$SPEC_TEST" bundle exec jekyll b -b "" -d "$SPEC_TEST"
fi fi
- name: Test Site - name: Test Site