2022-11-29 01:44:55 +08:00
|
|
|
name: Publish Site
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
paths-ignore:
|
|
|
|
- .github
|
|
|
|
- README.md
|
|
|
|
- LICENSE
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
deploy:
|
2023-11-29 18:59:36 +08:00
|
|
|
runs-on: ubuntu-latest
|
2022-11-29 01:44:55 +08:00
|
|
|
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2023-11-30 18:23:10 +08:00
|
|
|
- name: Prepare Alpine Linux with tools (latest)
|
|
|
|
uses: jirutka/setup-alpine@v1
|
2022-11-29 01:44:55 +08:00
|
|
|
with:
|
2023-11-30 18:23:10 +08:00
|
|
|
extra-repositories: |
|
|
|
|
https://dl-cdn.alpinelinux.org/alpine/edge/community
|
|
|
|
packages: >
|
|
|
|
bash
|
|
|
|
hugo
|
|
|
|
nodejs
|
|
|
|
npm
|
|
|
|
opencc
|
2023-11-30 18:26:35 +08:00
|
|
|
git
|
2023-11-30 18:23:10 +08:00
|
|
|
- name: Execute OpenCC in Alpine
|
|
|
|
run: bash ./scripts/opencc.sh
|
|
|
|
shell: alpine.sh {0}
|
|
|
|
- name: Prepare Node.js packages in Alpine
|
|
|
|
run: npm ci
|
|
|
|
shell: alpine.sh {0}
|
|
|
|
- name: Build the site in Alpine
|
|
|
|
run: hugo --minify
|
2022-11-29 01:44:55 +08:00
|
|
|
env:
|
2023-06-28 23:13:53 +08:00
|
|
|
HUGO_DISABLELANGUAGES: 'en'
|
2023-11-30 18:23:10 +08:00
|
|
|
shell: alpine.sh {0}
|
|
|
|
- name: Upload to CloudFlare
|
|
|
|
run: npx wrangler pages deploy public --project-name tfsci --branch main
|
2023-08-26 13:09:06 +08:00
|
|
|
if: github.ref == 'refs/heads/main'
|
2022-11-29 01:44:55 +08:00
|
|
|
env:
|
|
|
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
|
2023-08-26 13:09:06 +08:00
|
|
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
|
2023-11-30 18:23:10 +08:00
|
|
|
shell: bash
|