Merge pull request #356 from DESm1th/fixes #40
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 and publish docs | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-docs: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
id: cache | |
with: | |
path: docs/_build | |
key: docs-${{ hashFiles('./docs') }} | |
- uses: ./.github/setup_datman | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Install docs requirements | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: python -m pip install .[docs] | |
- name: Build docs | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: sphinx-build docs docs/_build | |
publish-docs: | |
needs: build-docs | |
if: github.event_name == 'push' | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
id: cache | |
with: | |
path: docs/_build | |
key: docs-${{ hashFiles('./docs') }} | |
- name: Add .nojekyll file to build folder | |
run: touch docs/_build/.nojekyll | |
- name: Deploy docs if the branch has updated | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: docs/_build |