Docs #2
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
# SPDX-License-Identifier: BSD-3-Clause | |
# Copyright (c) 2023 Scipp contributors (https://github.com/scipp) | |
name: Docs | |
on: | |
workflow_dispatch: | |
inputs: | |
publish: | |
default: false | |
type: boolean | |
version: | |
default: '' | |
required: false | |
type: string | |
branch: | |
description: 'Branch/tag with documentation source. If not set, the current branch will be used.' | |
default: '' | |
required: false | |
type: string | |
platform: | |
default: 'ubuntu-22.04' | |
type: string | |
workflow_call: | |
inputs: | |
publish: | |
default: false | |
type: boolean | |
version: | |
default: '' | |
required: false | |
type: string | |
branch: | |
description: 'Branch/tag with documentation source. If not set, the current branch will be used.' | |
default: '' | |
required: false | |
type: string | |
platform: | |
default: 'ubuntu-22.04' | |
type: string | |
defaults: | |
run: | |
shell: bash -l {0} # required for conda env | |
env: | |
VERSION: ${{ inputs.version }} | |
JUPYTER_PLATFORM_DIRS: 1 | |
jobs: | |
docs: | |
name: Documentation | |
runs-on: ${{ inputs.platform }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ inputs.branch == '' && github.ref_name || inputs.branch }} | |
fetch-depth: 0 # history required so setuptools_scm can determine version | |
- name: Setup conda environment | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: environment.yml | |
cache-environment: true | |
- run: python -m pip install --no-deps . | |
- run: jupyter --paths | |
- run: python docs/make_docs.py --build-dir=html_${{ inputs.platform }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: html_${{ inputs.platform }} | |
path: html_${{ inputs.platform }} | |
- uses: JamesIves/[email protected] | |
if: ${{ inputs.publish && contains(inputs.platform, 'ubuntu') }} | |
with: | |
branch: gh-pages | |
folder: html_${{ inputs.platform }} | |
target-folder: ${{ env.target }} | |
single-commit: true | |
clean-exclude: release |