Skip to content

Deploy Docs to GitHub Pages #19

Deploy Docs to GitHub Pages

Deploy Docs to GitHub Pages #19

Workflow file for this run

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:
miniforge-version: latest # Use MiniForge to avoid a potential lawsuit
environment-file: SlicerCART/docs/environment.yml
conda-remove-defaults: true # So we don't get sued by Anaconda
auto-activate-base: false # Don't load the default "test" environment by default...
activate-environment: slicercart_docs # ... load the one defined in the `environment.yml` instead
- name: TMP; Report Conda Prefix
run: mamba env export
- 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