| 1 | name: Generate documentation |
| 2 | |
| 3 | on: |
| 4 | workflow_dispatch: |
| 5 | |
| 6 | jobs: |
| 7 | generate: |
| 8 | runs-on: ubuntu-latest |
| 9 | |
| 10 | steps: |
| 11 | - name: Checkout |
| 12 | uses: actions/checkout@v4 |
| 13 | |
| 14 | - name: Setup pnpm |
| 15 | uses: pnpm/action-setup@v2 |
| 16 | with: |
| 17 | version: 8 |
| 18 | |
| 19 | - name: Setup Node.js |
| 20 | uses: actions/setup-node@v4 |
| 21 | with: |
| 22 | node-version: '20.x' |
| 23 | cache: 'pnpm' |
| 24 | |
| 25 | - name: Generate documentation |
| 26 | run: | |
| 27 | pnpm install --ignore-scripts --frozen-lockfile |
| 28 | pnpm typedoc |
| 29 | |
| 30 | - name: Commit files |
| 31 | if: github.repository == 'poolifier/poolifier' && github.ref == 'refs/heads/${{ github.event.repository.default_branch }}' |
| 32 | env: |
| 33 | COMMIT_MESSAGE: 'docs: generate documentation' |
| 34 | COMMIT_AUTHOR: Documentation Bot |
| 35 | COMMIT_EMAIL: documentation-bot@users.noreply.github.com |
| 36 | run: | |
| 37 | git config --local user.name "${{ env.COMMIT_AUTHOR }}" |
| 38 | git config --local user.email "${{ env.COMMIT_EMAIL }}" |
| 39 | git pull |
| 40 | git add ./docs |
| 41 | git commit -a -m "${{ env.COMMIT_MESSAGE }}" |
| 42 | |
| 43 | - name: Push changes |
| 44 | if: github.repository == 'poolifier/poolifier' && github.ref == 'refs/heads/${{ github.event.repository.default_branch }}' |
| 45 | uses: CasperWA/push-protected@v2 |
| 46 | with: |
| 47 | token: ${{ secrets.GH_TOKEN_PROTECTED }} |
| 48 | branch: ${{ github.event.repository.default_branch }} |