2021-11-13 03:05:05 +08:00
|
|
|
name: Generator
|
2021-11-13 02:56:41 +08:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ main ]
|
|
|
|
workflow_dispatch:
|
|
|
|
|
2022-12-31 04:04:03 +08:00
|
|
|
# One generator at a time
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2022-12-31 04:11:35 +08:00
|
|
|
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
|
|
|
permissions:
|
2022-12-31 09:20:07 +08:00
|
|
|
contents: write
|
2022-12-31 04:11:35 +08:00
|
|
|
pages: write
|
|
|
|
id-token: write
|
|
|
|
|
2021-11-13 02:56:41 +08:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
2023-01-06 01:21:02 +08:00
|
|
|
permissions: write-all
|
2021-11-13 02:56:41 +08:00
|
|
|
|
|
|
|
steps:
|
2023-01-06 01:17:07 +08:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-node@v3
|
2021-11-13 02:56:41 +08:00
|
|
|
with:
|
2023-01-06 01:17:07 +08:00
|
|
|
node-version: 18
|
2022-08-30 21:52:20 +08:00
|
|
|
|
2022-03-21 00:53:16 +08:00
|
|
|
- name: Cache node_modules
|
2022-08-30 21:52:20 +08:00
|
|
|
uses: actions/cache@v3
|
2022-03-21 00:53:16 +08:00
|
|
|
id: cache
|
2021-11-13 03:05:05 +08:00
|
|
|
with:
|
2022-03-21 00:53:16 +08:00
|
|
|
path: node_modules
|
|
|
|
key: ${{ runner.os }}-node-${{ hashFiles('yarn.lock') }}
|
|
|
|
restore-keys: ${{ runner.os }}-node-
|
2022-08-30 21:52:20 +08:00
|
|
|
|
2022-03-21 00:53:16 +08:00
|
|
|
- name: Install Dependencies
|
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
|
|
run: yarn install --production --frozen-lockfile
|
2022-08-30 21:52:20 +08:00
|
|
|
|
2022-03-21 00:53:16 +08:00
|
|
|
- name: Build
|
|
|
|
run: yarn build
|
2022-08-30 21:52:20 +08:00
|
|
|
|
2023-01-21 12:17:51 +08:00
|
|
|
- name: Deploy to GitHub branch
|
|
|
|
uses: JamesIves/github-pages-deploy-action@v4
|
|
|
|
with:
|
|
|
|
branch: gh-pages
|
|
|
|
folder: dist
|
|
|
|
|
|
|
|
- name: Deploy to Cloudflare Pages
|
2023-01-15 15:33:36 +08:00
|
|
|
uses: cloudflare/pages-action@v1
|
2022-12-31 04:11:35 +08:00
|
|
|
with:
|
2023-01-15 15:33:36 +08:00
|
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
|
|
projectName: our-data
|
|
|
|
directory: dist
|
2023-01-06 01:43:35 +08:00
|
|
|
|
|
|
|
- name: Check for document changes, ignoring comments
|
|
|
|
uses: dorny/paths-filter@v2
|
|
|
|
id: changes
|
|
|
|
with:
|
|
|
|
filters: |
|
|
|
|
src:
|
2023-01-15 01:03:34 +08:00
|
|
|
- 'people/**/*[^.json]'
|
2023-01-06 01:43:35 +08:00
|
|
|
|
2023-01-06 01:17:07 +08:00
|
|
|
- name: Trigger web repackage
|
|
|
|
uses: actions/github-script@v6
|
2023-01-06 01:43:35 +08:00
|
|
|
if: steps.changes.outputs.src == 'true'
|
2023-01-06 01:17:07 +08:00
|
|
|
with:
|
2023-01-06 01:27:19 +08:00
|
|
|
github-token: ${{ secrets.GH_PERSONAL_TOKEN }}
|
2023-01-06 01:17:07 +08:00
|
|
|
script: |
|
|
|
|
await github.rest.actions.createWorkflowDispatch({
|
|
|
|
owner: 'one-among-us',
|
|
|
|
repo: 'web',
|
|
|
|
workflow_id: 'package.yml',
|
|
|
|
ref: 'main'
|
|
|
|
})
|