Skip to content

Publish Website

Publish Website #3

Workflow file for this run

name: Publish Website
on:
workflow_call:
inputs:
new_version:
required: false
type: string
run_tutorials:
required: false
type: boolean
default: true
workflow_dispatch:
jobs:
build-website:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: 'docusaurus-versions' # release branch
fetch-depth: 0
- name: Sync release branch with main
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git merge origin/main
# To avoid a large number of commits we don't push this sync commit to github until a new release.
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
pip install -e ".[tutorial]"
- if: ${{ inputs.run_tutorials }}
name: Run Tutorials
run: |
python scripts/run_tutorials.py -w $(pwd)
- if: ${{ inputs.new_version }}
name: Create new docusaurus version
run: |
python3 scripts/convert_ipynb_to_mdx.py --clean
cd website
yarn
yarn docusaurus docs:version ${{ inputs.new_version }}
git add --all
git commit -m "Create version ${{ inputs.new_version }} of site in Docusaurus"
git push --force origin HEAD:docusaurus-versions
- name: Build website
run: |
bash scripts/make_docs.sh -b
- name: Upload website build as artifact
id: deployment
uses: actions/upload-pages-artifact@v3
with:
path: website/build/
deploy-website:
needs: build-website
permissions: write-all
# pages: write
# id-token: write
# deployments: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4