web/.github/workflows/pages-deploy.yml.hook
Cotes Chung 2cf5a58adf Install yq by APT on ubuntu of gh-actions.
`brew intall` on Ubuntu is too slow (about 1 min)
2020-09-17 13:54:12 +08:00

77 lines
1.8 KiB
Text

name: 'Automatic build'
on:
push:
branches:
- master
paths-ignore:
- '.gitignore'
- 'README.md'
- 'LICENSE'
jobs:
continuous-delivery:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-ruby@v1
with:
ruby-version: '2.6.x'
- name: Install tools
run: |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CC86BB64
sudo add-apt-repository ppa:rmescandon/yq
sudo apt update
sudo apt install yq -y
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Bundle Caching
id: bundle-cache
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Bundle config
run: |
bundle config path vendor/bundle
- 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
run: |
baseurl="$(grep '^baseurl:' _config.yml | yq r - baseurl)"
if [[ -n $baseurl ]]; then
echo "::set-env name=SPEC_TEST::_site_no_baseurl"
fi
- name: Build Site
run: |
bash tools/build.sh
if [[ -n $SPEC_TEST ]]; then
# Bypass the defects of htmlproofer
bash tools/build.sh -b "" -d "$SPEC_TEST"
fi
- name: Test Site
run: |
bash tools/test.sh "$SPEC_TEST"
- name: Deploy
run: |
bash tools/deploy.sh