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