Merge pull request #33 from microbiomedata/32-delete-static-workflow-… #7
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: Fetch and compile MAG workflow documentation | |
on: | |
push: { branches: [ main ] } | |
workflow_dispatch: { } | |
# Allow this workflow to be called by other workflows. | |
# Reference: https://docs.github.com/en/actions/using-workflows/reusing-workflows | |
workflow_call: { } | |
jobs: | |
compile: | |
name: Compile | |
runs-on: ubuntu-latest | |
steps: | |
# Docs: https://github.com/actions/checkout | |
- name: Check out commit | |
uses: actions/checkout@v4 | |
# Note: The default branch of the `metaMAGs` repository is named "master" | |
- name: Check out commit from `metaMAGs/master` | |
uses: actions/checkout@v4 | |
with: | |
# Notes: | |
# - `repository` format is: "{owner_name}/{repo_name}" | |
# - The default branch of the `metaMAGs` repository is named "master" | |
repository: microbiomedata/metaMAGs # format is "{owner_name}/{repo_name}" | |
ref: master | |
sparse-checkout: | | |
docs | |
path: _clones/microbiomedata/metaMAGs # where, locally, to create the clone | |
# Docs: https://github.com/actions/setup-python | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: { python-version: '3.12' } | |
- name: Install dependencies of `metaMAGs` docs | |
run: python -m pip install sphinx sphinx_rtd_theme | |
# Docs: https://www.sphinx-doc.org/en/master/man/sphinx-build.html | |
# | |
# Notes: | |
# - We use the "spinx_rtd_theme" because that's what the legacy "workflow_documentation" repo uses. | |
# - The `--define` option overrides the corresponding parameter in the `conf.py` file. | |
# - The `--builder` option is an alias for the `-b` option. | |
# | |
- name: Compile source documents into HTML | |
working-directory: _clones/microbiomedata/metaMAGs | |
run: sphinx-build --define html_theme='sphinx_rtd_theme' --builder html docs ${{ github.workspace }}/_dist | |
# 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: mag-workflow-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: _dist | |
if-no-files-found: error | |
retention-days: 1 # Note: 1 day is the shortest period possible |