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

73 lines
1.9 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:
2022-08-08 21:08:12 +08:00
- .github
- README.md
- LICENSE
2020-10-27 20:42:13 +08:00
jobs:
2022-08-10 22:33:07 +08:00
build-mtf-dot-wiki:
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:
2022-08-08 21:08:12 +08:00
hugo-version: latest
2021-11-28 08:45:19 +08:00
extended: true
2022-08-10 22:33:07 +08:00
- name: Build
2022-03-09 20:41:51 +08:00
run: hugo --minify --enableGitInfo
2022-08-10 22:33:07 +08:00
- name: Upload artifact
2021-11-28 08:45:19 +08:00
if: github.ref == 'refs/heads/master'
2022-08-04 22:37:56 +08:00
uses: actions/upload-pages-artifact@v1
2020-10-27 20:42:13 +08:00
with:
2022-08-04 22:37:56 +08:00
path: public
2022-08-10 22:33:07 +08:00
deploy-mtf-dot-wiki:
needs: build-mtf-dot-wiki
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-20.04
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
deploy-mtfwiki-dot-com:
runs-on: ubuntu-20.04
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
steps:
- uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 0
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: latest
extended: true
- name: Build
2022-03-09 20:41:51 +08:00
run: hugo --minify --enableGitInfo --baseURL https://mtfwiki.com
2022-08-10 22:33:07 +08:00
- name: Deploy
2021-11-28 09:24:30 +08:00
uses: reggionick/s3-deploy@v3
if: github.ref == 'refs/heads/master'
with:
2022-08-04 22:37:56 +08:00
folder: public
bucket: mtfwiki.com
2021-11-28 09:24:30 +08:00
bucket-region: ${{ secrets.S3_BUCKET_REGION }}
2021-11-28 09:31:45 +08:00
delete-removed: true
private: true
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}