pokerogue/.github/workflows/github-pages.yml
2025-09-10 11:42:38 -05:00

82 lines
2.2 KiB
YAML

name: "Github Pages"
on:
push:
branches:
- main
- beta
- release
- 'hotfix*'
pull_request:
branches:
- main
- beta
- release
- 'hotfix*'
merge_group:
types: [checks_requested]
jobs:
pages:
name: Github Pages
if: github.repository == 'pagefaultgames/pokerogue'
timeout-minutes: 10
runs-on: ubuntu-latest
env:
docs-dir: ./pokerogue_docs
# Only push docs when running on pushes to main/beta
DRY_RUN: ${{github.event_name != 'push' || (github.ref_name != 'beta' && github.ref_name != 'main')}}
steps:
- name: Checkout repository for Typedoc
uses: actions/checkout@v4
with:
path: pokerogue_docs
sparse-checkout: |
/*
!/public/
/public/images/pokemon/variant/_exp_masterlist.json
/public/images/pokemon/variant/_masterlist.json
/public/images/logo.png
sparse-checkout-cone-mode: false
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: "pokerogue_docs/.nvmrc"
- name: Checkout repository for Github Pages
if: github.event_name == 'push'
uses: actions/checkout@v4
with:
path: pokerogue_gh
ref: gh-pages
- name: Install Node.js dependencies
working-directory: ${{env.docs-dir}}
run: pnpm i
- name: Generate Typedoc docs
working-directory: ${{env.docs-dir}}
env:
REF_NAME: ${{github.ref_name}}
DRY_RUN: ${{env.DRY_RUN}}
run: pnpm typedoc
- name: Commit & Push docs
# env vars are stored as strings instead of booleans (hence why an explicit check is required)
if: ${{ env.DRY_RUN == 'false'}}
run: |
cd pokerogue_gh
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
rsync -rd --delete /tmp/docs/ $GITHUB_REF_NAME
git add $GITHUB_REF_NAME
git commit -m "[skip ci] Deploy docs"
git push