2020-07-28 21:27:40 +03:00
|
|
|
name: 'Automatic build'
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
paths-ignore:
|
2020-10-03 11:45:17 +03:00
|
|
|
- .gitignore
|
|
|
|
- README.md
|
|
|
|
- LICENSE
|
2020-07-28 21:27:40 +03:00
|
|
|
|
|
|
|
jobs:
|
2020-09-16 20:28:44 +03:00
|
|
|
continuous-delivery:
|
2020-10-07 18:53:05 +03:00
|
|
|
|
2020-07-28 21:27:40 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
2020-10-03 11:45:17 +03:00
|
|
|
env:
|
|
|
|
GEMS_PATH: /tmp/bundle
|
|
|
|
|
2020-07-28 21:27:40 +03:00
|
|
|
steps:
|
|
|
|
- uses: actions/setup-ruby@v1
|
|
|
|
with:
|
2020-10-03 11:45:17 +03:00
|
|
|
ruby-version: 2.6.x
|
2020-07-28 21:27:40 +03:00
|
|
|
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Bundle Caching
|
|
|
|
id: bundle-cache
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
2020-10-03 11:45:17 +03:00
|
|
|
path: ${{ env.GEMS_PATH }}
|
2020-07-28 21:27:40 +03:00
|
|
|
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-gems-
|
|
|
|
|
|
|
|
- name: Bundle config
|
|
|
|
run: |
|
2020-10-03 11:45:17 +03:00
|
|
|
bundle config path ${{ env.GEMS_PATH }}
|
2020-07-28 21:27:40 +03:00
|
|
|
|
|
|
|
- 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-11-19 15:39:02 +03:00
|
|
|
baseurl="$(grep '^baseurl:' _config.yml | sed "s/.*: *//;s/['\"]//g;s/#.*//")"
|
2020-09-16 20:28:44 +03:00
|
|
|
if [[ -n $baseurl ]]; then
|
2020-10-07 18:53:05 +03:00
|
|
|
echo "SPEC_TEST=_site_no_baseurl" >> $GITHUB_ENV
|
2020-09-16 20:28:44 +03:00
|
|
|
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-11-19 15:39:02 +03:00
|
|
|
JEKYLL_ENV=production bundle exec jekyll b
|
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
|
2020-11-19 15:39:02 +03:00
|
|
|
JEKYLL_ENV=production bundle exec jekyll b -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
|