78 lines
1.8 KiB
Text
78 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
|
|
|
|
env:
|
|
GEMS_PATH: /tmp/bundle
|
|
|
|
steps:
|
|
- uses: actions/setup-ruby@v1
|
|
with:
|
|
ruby-version: 2.6.x
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Bundle Caching
|
|
id: bundle-cache
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: ${{ env.GEMS_PATH }}
|
|
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-gems-
|
|
|
|
- name: Bundle config
|
|
run: |
|
|
bundle config path ${{ env.GEMS_PATH }}
|
|
|
|
- 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 | sed "s/.*: *//;s/['\"]//g;s/#.*//")"
|
|
if [[ -n $baseurl ]]; then
|
|
echo "SPEC_TEST=_site_no_baseurl" >> $GITHUB_ENV
|
|
fi
|
|
|
|
- name: Build Site
|
|
run: |
|
|
JEKYLL_ENV=production bundle exec jekyll b
|
|
|
|
if [[ -n $SPEC_TEST ]]; then
|
|
# Bypass the defects of htmlproofer
|
|
JEKYLL_ENV=production bundle exec jekyll b -b "" -d "$SPEC_TEST"
|
|
fi
|
|
|
|
- name: Test Site
|
|
run: |
|
|
if [[ -n $SPEC_TEST ]]; then
|
|
bash tools/test.sh -d "$SPEC_TEST"
|
|
else
|
|
bash tools/test.sh
|
|
fi
|
|
|
|
- name: Deploy
|
|
run: |
|
|
bash tools/deploy.sh
|