2020-07-28 21:27:40 +03:00
|
|
|
name: 'Automatic build'
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
paths-ignore:
|
|
|
|
- '.gitignore'
|
|
|
|
- 'README.md'
|
|
|
|
- 'LICENSE'
|
|
|
|
|
|
|
|
jobs:
|
2020-09-16 20:28:44 +03:00
|
|
|
continuous-delivery:
|
2020-07-28 21:27:40 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/setup-ruby@v1
|
|
|
|
with:
|
|
|
|
ruby-version: '2.6.x'
|
|
|
|
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2020-09-16 20:28:44 +03:00
|
|
|
- name: Install yq
|
|
|
|
run: |
|
|
|
|
brew install yq
|
|
|
|
|
2020-07-28 21:27:40 +03:00
|
|
|
- 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
|
|
|
|
|
2020-09-16 20:28:44 +03:00
|
|
|
- name: Check baseurl
|
2020-07-28 21:27:40 +03:00
|
|
|
run: |
|
2020-09-16 20:28:44 +03:00
|
|
|
baseurl="$(grep '^baseurl:' _config.yml | yq r - baseurl)"
|
|
|
|
if [[ -n $baseurl ]]; then
|
|
|
|
echo "::set-env name=SPEC_TEST::_site_no_baseurl"
|
|
|
|
fi
|
2020-07-28 21:27:40 +03:00
|
|
|
|
2020-09-16 20:28:44 +03:00
|
|
|
- name: Build Site
|
2020-07-28 21:27:40 +03:00
|
|
|
run: |
|
2020-09-16 20:28:44 +03:00
|
|
|
bash tools/build.sh
|
2020-07-28 21:27:40 +03:00
|
|
|
|
2020-09-16 20:28:44 +03:00
|
|
|
if [[ -n $SPEC_TEST ]]; then
|
|
|
|
# Bypass the defects of htmlproofer
|
|
|
|
bash tools/build.sh -b "" -d "$SPEC_TEST"
|
|
|
|
fi
|
2020-07-28 21:27:40 +03:00
|
|
|
|
2020-09-16 20:28:44 +03:00
|
|
|
- name: Test Site
|
2020-07-28 21:27:40 +03:00
|
|
|
run: |
|
2020-09-16 20:28:44 +03:00
|
|
|
bash tools/test.sh "$SPEC_TEST"
|
2020-07-28 21:27:40 +03:00
|
|
|
|
|
|
|
- name: Deploy
|
|
|
|
run: |
|
|
|
|
bash tools/deploy.sh
|