aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/build-api.yml
blob: 29c87c1534e44a60877224df513f0639bdda0f65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Build API Doc

on:
    push:
        tags:
          - "v*"
    workflow_dispatch:
      inputs:
        reason:
          type: string
          required: false
          description: 'The reason to manually trigger api doc build'

jobs:
    update-api-doc:
        runs-on: ubuntu-latest
        environment: release
        permissions:
          contents: write
          pull-requests: write
          id-token: write
        steps:
          - uses: actions/checkout@v3
    
          - uses: pdm-project/setup-pdm@v4
            name: Setup PDM
            with:
              python-version: 3.9
              cache: true

          # - name: sync pdm.lock
          #   run: pdm sync

          - name: Install dependencies
            run: pdm install --group docs --dev --no-default
    
          - name: Remove API Doc
            run: rm -rf docs/source/api

          - name: Clone Submodule
            run: |
              git submodule update --init --recursive

          - name: Moving Submodule
            run: |
              mkdir -p modules
              mv DiceParser/src/oneroll modules/OneRoll
              mv GetPlayerCard/get_pc modules/GetPlayerCard
              mv HydroRollCore/hrc modules/HydroRollCore
              mv TRPGNivis/nivis_python modules/TRPGNivisSDK

          - name: Build API Doc For HydroRoll
            run: |
              cp -r hydro_roll modules/HydroRoll
              pdm run sphinx-apidoc -o docs/source/api modules -f -e --tocfile index

          - name: Remove Temp Folder
            run: |
              rm -rf modules

          - name: Commit 
            uses: stefanzweifel/git-auto-commit-action@v5
            with:
              branch: main
              commit_message: "chore(docs): update api docs with sphinx-apidoc"