Merge pull request #437 from NERSC/quantem-updates #249
This file contains hidden or 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: Documentation | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: [ 'v*' ] | |
| pull_request: | |
| branches: [ main ] | |
| paths: | |
| - 'docs/**' | |
| - '.github/workflows/docs.yml' | |
| - '**/README.md' | |
| - '**/.env.example' | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| # Fetch all history for sphinx-multiversion | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| - name: Cache Poetry virtualenv | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| docs/.venv | |
| ~/.cache/pypoetry | |
| key: ${{ runner.os }}-poetry-${{ hashFiles('docs/poetry.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-poetry- | |
| - name: Install dependencies | |
| working-directory: docs | |
| run: poetry install --no-interaction | |
| - name: Build documentation | |
| working-directory: docs | |
| run: make build | |
| - name: Upload documentation artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: docs-${{ github.sha }} | |
| path: docs/_build/html | |
| retention-days: 30 | |
| deploy: | |
| if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download documentation artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: docs-${{ github.sha }} | |
| path: ./docs | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GHCR_PAT }} | |
| publish_dir: ./docs | |
| keep_files: true | |
| enable_jekyll: false |