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:
|
2021-03-03 14:00:52 +03:00
|
|
|
GEMS_PATH: vendor/bundle
|
2020-10-03 11:45:17 +03:00
|
|
|
|
2020-07-28 21:27:40 +03:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
2020-11-22 20:26:29 +03:00
|
|
|
fetch-depth: 0 # for posts's lastmod
|
|
|
|
|
|
|
|
- name: Setup Ruby
|
|
|
|
uses: actions/setup-ruby@v1
|
|
|
|
with:
|
2020-12-06 18:12:20 +03:00
|
|
|
ruby-version: 2.7
|
2020-07-28 21:27:40 +03:00
|
|
|
|
|
|
|
- name: Bundle Caching
|
2020-11-22 20:26:29 +03:00
|
|
|
uses: actions/cache@v2
|
2020-07-28 21:27:40 +03:00
|
|
|
with:
|
2020-10-03 11:45:17 +03:00
|
|
|
path: ${{ env.GEMS_PATH }}
|
2020-12-06 18:12:20 +03:00
|
|
|
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
2020-07-28 21:27:40 +03:00
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-gems-
|
|
|
|
|
|
|
|
- name: Bundle Install
|
|
|
|
run: |
|
2020-11-22 20:26:29 +03:00
|
|
|
bundle config path ${{ env.GEMS_PATH }}
|
|
|
|
bundle install --jobs 4 --retry 3
|
2020-07-28 21:27:40 +03:00
|
|
|
|
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-12-30 17:22:42 +03:00
|
|
|
echo "BASE_URL=$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-11-22 20:26:29 +03:00
|
|
|
env:
|
|
|
|
JEKYLL_ENV: production
|
2020-07-28 21:27:40 +03:00
|
|
|
run: |
|
2020-12-30 17:22:42 +03:00
|
|
|
bundle exec jekyll b -d "_site$BASE_URL"
|
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-12-30 17:22:42 +03:00
|
|
|
bash tools/test.sh
|
2020-12-06 18:12:20 +03:00
|
|
|
|
2020-07-28 21:27:40 +03:00
|
|
|
- name: Deploy
|
|
|
|
run: |
|
2020-12-30 17:22:42 +03:00
|
|
|
if [[ -n $BASE_URL ]]; then
|
|
|
|
mv _site$BASE_URL _site-rename
|
|
|
|
rm -rf _site
|
|
|
|
mv _site-rename _site
|
|
|
|
fi
|
|
|
|
|
2020-07-28 21:27:40 +03:00
|
|
|
bash tools/deploy.sh
|