2020-07-29 02:27:40 +08:00
|
|
|
name: 'Automatic build'
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
paths-ignore:
|
2020-10-03 16:45:17 +08:00
|
|
|
- .gitignore
|
|
|
|
- README.md
|
|
|
|
- LICENSE
|
2020-07-29 02:27:40 +08:00
|
|
|
|
|
|
|
jobs:
|
2020-09-17 01:28:44 +08:00
|
|
|
continuous-delivery:
|
2020-10-07 23:53:05 +08:00
|
|
|
|
2020-07-29 02:27:40 +08:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
2020-11-23 01:26:29 +08:00
|
|
|
fetch-depth: 0 # for posts's lastmod
|
|
|
|
|
|
|
|
- name: Setup Ruby
|
2021-04-01 04:17:18 +08:00
|
|
|
uses: ruby/setup-ruby@v1
|
2020-11-23 01:26:29 +08:00
|
|
|
with:
|
2020-12-06 23:12:20 +08:00
|
|
|
ruby-version: 2.7
|
2021-04-01 04:17:18 +08:00
|
|
|
bundler-cache: true
|
2020-07-29 02:27:40 +08:00
|
|
|
|
2020-09-17 01:28:44 +08:00
|
|
|
- name: Check baseurl
|
2020-07-29 02:27:40 +08:00
|
|
|
run: |
|
2020-11-19 20:39:02 +08:00
|
|
|
baseurl="$(grep '^baseurl:' _config.yml | sed "s/.*: *//;s/['\"]//g;s/#.*//")"
|
2020-09-17 01:28:44 +08:00
|
|
|
if [[ -n $baseurl ]]; then
|
2020-12-30 15:22:42 +01:00
|
|
|
echo "BASE_URL=$baseurl" >> $GITHUB_ENV
|
2020-09-17 01:28:44 +08:00
|
|
|
fi
|
2020-07-29 02:27:40 +08:00
|
|
|
|
2020-09-17 01:28:44 +08:00
|
|
|
- name: Build Site
|
2020-11-23 01:26:29 +08:00
|
|
|
env:
|
|
|
|
JEKYLL_ENV: production
|
2020-07-29 02:27:40 +08:00
|
|
|
run: |
|
2020-12-30 15:22:42 +01:00
|
|
|
bundle exec jekyll b -d "_site$BASE_URL"
|
2020-07-29 02:27:40 +08:00
|
|
|
|
2020-09-17 01:28:44 +08:00
|
|
|
- name: Test Site
|
2020-07-29 02:27:40 +08:00
|
|
|
run: |
|
2020-12-30 15:22:42 +01:00
|
|
|
bash tools/test.sh
|
2020-12-06 23:12:20 +08:00
|
|
|
|
2020-07-29 02:27:40 +08:00
|
|
|
- name: Deploy
|
|
|
|
run: |
|
2020-12-30 15:22:42 +01:00
|
|
|
if [[ -n $BASE_URL ]]; then
|
|
|
|
mv _site$BASE_URL _site-rename
|
|
|
|
rm -rf _site
|
|
|
|
mv _site-rename _site
|
|
|
|
fi
|
|
|
|
|
2020-07-29 02:27:40 +08:00
|
|
|
bash tools/deploy.sh
|