| name: Documentation | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request_target: | |
| types: | |
| - closed | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| docs: | |
| name: Build and Publish Docs | |
| if: | | |
| github.repository_owner == 'SJTU-DENG-Lab' && | |
| ( | |
| ( | |
| github.event_name == 'push' && | |
| github.ref == 'refs/heads/main' | |
| ) || | |
| ( | |
| github.event_name == 'pull_request_target' && | |
| github.event.pull_request.merged == true && | |
| github.event.pull_request.base.ref == 'main' | |
| ) || | |
| github.event_name == 'workflow_dispatch' | |
| ) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.10" | |
| - name: Build docs | |
| run: | | |
| bash -ex script/build_docs.sh | |
| - name: Publish docs to gh-pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./docs/_build/html | |
| publish_branch: gh-pages | |
| force_orphan: true | |