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 - name: Get submodule ref id: asset-submodule-ref run: | cd pokerogue_docs SUBMODULE_REF=$(git submodule status assets | awk '{print $1}' | sed 's/^-//') echo "asset_ref=$SUBMODULE_REF" >> $GITHUB_OUTPUT rm -rf assets - name: Checkout asset submodule uses: actions/checkout@v4 with: repository: 'pagefaultgames/pokerogue-assets' ref: ${{ steps.asset-submodule-ref.asset_ref }} path: pokerogue_docs/assets sparse-checkout: | images/pokemon/variant/_exp_masterlist.json images/pokemon/variant/_masterlist.json images/logo.png sparse-checkout-cone-mode: true - 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