Deploy Docs to GitHub Pages #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Docs to GitHub Pages | |
| on: | |
| push: | |
| branches: [main] | |
| # Below will ensure this only runs when the website's contents changed | |
| paths: | |
| - 'SlicerCART/docs/_source/**' | |
| workflow_dispatch: | |
| inputs: | |
| artifact_website: | |
| description: "Save the website as an artifact to review?" | |
| type: choice | |
| options: | |
| - "Yes" | |
| - "No" | |
| default: "Yes" | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Miniconda | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| environment-file: SlicerCART/docs/environment.yml | |
| activate-environment: true # Required by Python 3.13 | |
| auto-activate-base: true # Load this environment by default | |
| - name: Build Website Files | |
| run: | | |
| # Enter the documentation path | |
| cd SlicerCART/docs | |
| # Rebuild the website w/ Sphinx | |
| make html | |
| - name: Deploy to GitHub Pages | |
| # Only update the official website if this was a change to 'main' | |
| # TODO: Update when a proper release management system is made | |
| if: github.event_name == 'push' | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| # Directory below is built in the prior step | |
| publish_dir: ./SlicerCART/docs/_build | |
| publish_branch: gh-pages | |
| force_orphan: true | |
| - name: Save Website as Artifact | |
| # Only save the files as an artifact if requested | |
| if: github.event_name == 'workflow_dispatch' && github.event.inputs.artifact_website == 'Yes' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: built_website | |
| path: ./SlicerCART/docs/_build |