Configure GHA to build and deploy umbrella website to GitHub Pages #4
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
# This GitHub Actions workflow compiles the Sphinx documentation into web-based documentation. | |
# Reference: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions | |
name: Compile legacy NMDC documentation into HTML | |
on: | |
push: { branches: [ main ] } | |
workflow_dispatch: { } | |
jobs: | |
compile: | |
name: Compile | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
# Set a default working directory for all `run` steps in this job. | |
# Reference: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_iddefaultsrun | |
working-directory: legacy/nmdc-documentation | |
permissions: | |
contents: read | |
steps: | |
- name: Check out commit # Docs: https://github.com/actions/checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python # Docs: https://github.com/actions/setup-python | |
uses: actions/setup-python@v5 | |
with: { python-version: '3.12' } | |
- name: Install Sphinx # Docs: https://pypi.org/project/Sphinx/ | |
run: pip install Sphinx | |
- name: Install other dependencies | |
run: pip install -r requirements.txt | |
- name: Compile source documents into HTML | |
run: sphinx-build -b html src ${{ github.workspace }}/legacy/nmdc-documentation/_build/html | |
# Upload the result as an "artifact" so it can then be downloaded and used by another job. | |
- name: Save the HTML for publishing later # Docs: https://github.com/actions/upload-artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: legacy-nmdc-documentation-as-html | |
# Note: Relative `path` values here are relative to the _workspace_, not to the current working directory. | |
# Reference: https://github.com/actions/upload-artifact/pull/477#issue-2044900649 | |
path: legacy/nmdc-documentation/_build/html | |
if-no-files-found: error | |
retention-days: 1 # Note: 1 day is the shortest period possible |