This repository has been archived by the owner on Nov 10, 2023. It is now read-only.
Use GitHub pages #129
This file contains 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: Build Tutorials | |
on: | |
push: | |
branches: [ master ] | |
tags: ["*"] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
inputs: | |
run_deploy: | |
description: 'Should newest tag be deployed?' | |
required: false | |
default: "" | |
defaults: | |
run: | |
shell: bash -leo pipefail {0} {0} | |
jobs: | |
find-tag: | |
runs-on: ubuntu-latest | |
outputs: | |
latest-tag: ${{ steps.find-tag.outputs.tag }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Find latest tag | |
id: find-tag | |
run: | | |
$LASTTAG="$(git describe --tags `git rev-list --tags --max-count=1`)" | |
echo "tag=$LASTTAG)" >> "$GITHUB_OUTPUT" | |
link-check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install mamba | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: environment.yaml | |
- run: sphinx-build -M linkcheck . _build -W --keep-going -a -q | |
link-check-official: | |
runs-on: ubuntu-latest | |
needs: find-tag | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ needs.find-tag.outputs.latest-tag }} | |
- name: Install mamba | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: environment.yaml | |
- run: sphinx-build -M linkcheck . _build -W --keep-going -a -q | |
build: | |
runs-on: ubuntu-latest | |
needs: [find-tag, link-check] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install mamba | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: environment.yaml | |
- name: Build Documentation | |
run: | | |
sphinx-build -M html . _build-beta -W --keep-going -a -t draft | |
- name: Checkout last tagged | |
run: | | |
git checkout ${{ needs.find-tag.outputs.latest-tag }} | |
- name: Build environment for last tagged version | |
run: micromamba create -n tutorial-tagged -y -f environment.yaml | |
- name: Build last tagged version | |
run: | | |
conda activate tutorial-tagged | |
sphinx-build -M html . _build -W --keep-going -a | |
- name: Prepare html for upload | |
run: | | |
mkdir -p gh-pages/beta | |
cp -rT _build-beta/html gh-pages/beta | |
cp -rT _build/html gh-pages | |
- uses: actions/upload-pages-artifact@v2 | |
with: | |
path: gh-pages | |
deploy: | |
needs: build | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 | |