|
| 1 | +name: Build and Deploy Documentation |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize, reopened] |
| 6 | + |
| 7 | +jobs: |
| 8 | + Build_and_deploy_dev_doc: |
| 9 | + environment: dev-documentation |
| 10 | + runs-on: ubuntu-latest |
| 11 | + permissions: |
| 12 | + contents: write |
| 13 | + steps: |
| 14 | + - name: Checkout repository |
| 15 | + uses: actions/checkout@v4 |
| 16 | + |
| 17 | + - name: Setup PDM |
| 18 | + uses: pdm-project/setup-pdm@v4 |
| 19 | + with: |
| 20 | + python-version: '3.13' |
| 21 | + |
| 22 | + - name: Install dependencies (default & doc) |
| 23 | + run: pdm install --group doc --frozen-lockfile |
| 24 | + |
| 25 | + - name: Build Documentation |
| 26 | + working-directory: docs |
| 27 | + run: pdm run make dirhtml |
| 28 | + |
| 29 | + - name: Determine deployment folder |
| 30 | + id: deploy_folder |
| 31 | + run: | |
| 32 | + echo "Determining deployment folder..." |
| 33 | + echo "Deploying to target ${{ github.event.number }}" |
| 34 | + echo "DEPLOY_DIR=${{ github.event.number }}" >> $GITHUB_OUTPUT |
| 35 | +
|
| 36 | + - name: Deploy to DEPLOY_DIR of TorchJD/documentation |
| 37 | + uses: peaceiris/actions-gh-pages@v4 |
| 38 | + with: |
| 39 | + deploy_key: ${{ secrets.DEV_DOCUMENTATION_DEPLOY_KEY }} |
| 40 | + publish_dir: docs/build/dirhtml |
| 41 | + destination_dir: ${{ steps.deploy_folder.outputs.DEPLOY_DIR }} |
| 42 | + external_repository: TorchJD/dev-documentation |
| 43 | + publish_branch: main |
| 44 | + |
| 45 | + - name: Add documentation link to summary |
| 46 | + run: | |
| 47 | + echo "### 📄 [View Deployed Documentation](https://dev.torchjd.github.io/documentation/${{ steps.deploy_folder.outputs.DEPLOY_DIR }})" >> $GITHUB_STEP_SUMMARY |
0 commit comments