|
| 1 | +# TOPSTSCHOOL Sphinx (Documentation) Deployment Workflow |
| 2 | +# ====================================================== |
| 3 | +# |
| 4 | +# Author: Akshay Mestry <[email protected]> |
| 5 | +# Created on: Sunday, October 27 2024 |
| 6 | +# Last updated on: Sunday, October 27 2024 |
| 7 | + |
| 8 | +name: deployment |
| 9 | +run-name: Auto-started ${{ github.workflow }} after linting |
| 10 | + |
| 11 | +on: |
| 12 | + workflow_run: |
| 13 | + workflows: [linting] |
| 14 | + types: [completed] |
| 15 | + branches: [$default-branch] |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: write |
| 19 | + |
| 20 | +env: |
| 21 | + ARTIFACTNAME: topstschool-pages |
| 22 | + BUILDDIR: docs/build/ |
| 23 | + SOURCEDIR: docs/source |
| 24 | + PYTHONVERSION: 3.12.1 |
| 25 | + |
| 26 | +concurrency: |
| 27 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 28 | + cancel-in-progress: true |
| 29 | + |
| 30 | +jobs: |
| 31 | + build: |
| 32 | + name: build |
| 33 | + runs-on: ubuntu-latest |
| 34 | + if: ${{ github.event.workflow_run.conclusion == 'success' }} |
| 35 | + steps: |
| 36 | + - name: Checkout |
| 37 | + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 |
| 38 | + with: |
| 39 | + fetch-depth: 1 |
| 40 | + - name: Setup |
| 41 | + uses: actions/setup-python@v5 |
| 42 | + with: |
| 43 | + python-version: ${{ env.PYTHONVERSION }} |
| 44 | + cache: pip |
| 45 | + - name: Build pages with Sphinx |
| 46 | + id: build |
| 47 | + run: | |
| 48 | + echo "Clean installing latest version of sphinx and other runtime dependencies..." |
| 49 | + python -m pip install -Uq pip -rrequirements.txt |
| 50 | + echo "Building documentation pages..." |
| 51 | + sphinx-build -EWqa --builder html ${{ env.SOURCEDIR }} ${{ env.BUILDDIR }} |
| 52 | + - name: Upload artifact |
| 53 | + uses: actions/upload-pages-artifact@v3 |
| 54 | + with: |
| 55 | + name: ${{ env.ARTIFACTNAME }} |
| 56 | + path: ${{ env.BUILDDIR }} |
| 57 | + deploy: |
| 58 | + name: deploy |
| 59 | + needs: build |
| 60 | + permissions: |
| 61 | + contents: read |
| 62 | + pages: write |
| 63 | + id-token: write |
| 64 | + environment: |
| 65 | + name: canary |
| 66 | + url: ${{ steps.deployment.outputs.page_url }} |
| 67 | + runs-on: ubuntu-latest |
| 68 | + steps: |
| 69 | + - name: Deploy to GitHub Pages |
| 70 | + id: deployment |
| 71 | + uses: actions/deploy-pages@v4 |
| 72 | + with: |
| 73 | + artifact_name: ${{ env.ARTIFACTNAME }} |
0 commit comments