MtF-wiki/.github/workflows/build-gh-pages.yml

61 lines
1.7 KiB
YAML
Raw Normal View History

2020-10-27 20:42:13 +08:00
name: Publish Site
on:
push:
branches:
- master
2020-10-27 20:42:13 +08:00
paths-ignore:
2021-12-24 10:23:22 +08:00
- '.github'
2020-10-27 20:42:13 +08:00
- 'README.md'
- 'LICENSE'
jobs:
build-deploy:
2021-11-28 08:45:19 +08:00
runs-on: ubuntu-20.04
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
2020-10-27 20:42:13 +08:00
steps:
2021-11-28 08:45:19 +08:00
- uses: actions/checkout@v2
2020-10-27 20:42:13 +08:00
with:
submodules: true
2021-11-28 08:45:19 +08:00
fetch-depth: 0
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: latest
extended: true
- name: Hugo Cache
uses: actions/cache@v2
with:
path: /tmp/hugo_cache
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-hugomod-
2021-11-28 10:22:06 +08:00
- name: Build `mtf.wiki`
2021-12-24 09:22:19 +08:00
run: hugo --minify
2021-11-28 09:24:30 +08:00
- name: Deploy `mtf.wiki`
2021-11-28 08:45:19 +08:00
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/master'
2020-10-27 20:42:13 +08:00
with:
2021-11-28 08:51:04 +08:00
deploy_key: ${{ secrets.DEPLOY_KEY }}
2021-11-28 08:45:19 +08:00
publish_branch: master
publish_dir: ./public
cname: mtf.wiki
external_repository: mtf-wiki/mtf-wiki.github.io
force_orphan: true
2021-11-28 10:22:06 +08:00
- name: Build `mtfwiki.com`
run: hugo --minify --baseURL https://mtfwiki.com
2021-11-28 09:24:30 +08:00
- name: Deploy `mtfwiki.com`
uses: reggionick/s3-deploy@v3
if: github.ref == 'refs/heads/master'
with:
folder: ./public
2021-11-28 09:31:45 +08:00
bucket: mtfwiki
2021-11-28 09:24:30 +08:00
bucket-region: ${{ secrets.S3_BUCKET_REGION }}
2021-11-28 12:38:26 +08:00
dist-id: E1TI1WW8VI3XF5
invalidation: /*
2021-11-28 09:31:45 +08:00
delete-removed: true
2021-11-28 12:38:26 +08:00
no-cache: true
2021-11-28 09:31:45 +08:00
private: true
2021-11-28 09:24:30 +08:00
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}