1
0
mirror of https://github.com/one-among-us/data.git synced 2024-11-24 12:07:37 +08:00
one-among-us-data/.github/workflows/generator.yml
2023-01-21 12:20:25 +08:00

79 lines
2.0 KiB
YAML

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