diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml new file mode 100644 index 0000000..8392d45 --- /dev/null +++ b/.github/workflows/deployment.yml @@ -0,0 +1,73 @@ +# TOPSTSCHOOL Sphinx (Documentation) Deployment Workflow +# ====================================================== +# +# Author: Akshay Mestry +# Created on: Sunday, October 27 2024 +# Last updated on: Sunday, October 27 2024 + +name: deployment +run-name: Auto-started ${{ github.workflow }} after linting + +on: + workflow_run: + workflows: [linting] + types: [completed] + branches: [$default-branch] + +permissions: + contents: write + +env: + ARTIFACTNAME: topstschool-pages + BUILDDIR: docs/build/ + SOURCEDIR: docs/source + PYTHONVERSION: 3.12.1 + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + name: build + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - name: Checkout + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 + with: + fetch-depth: 1 + - name: Setup + uses: actions/setup-python@v5 + with: + python-version: ${{ env.PYTHONVERSION }} + cache: pip + - name: Build pages with Sphinx + id: build + run: | + echo "Clean installing latest version of sphinx and other runtime dependencies..." + python -m pip install -Uq pip -rrequirements.txt + echo "Building documentation pages..." + sphinx-build -EWqa --builder html ${{ env.SOURCEDIR }} ${{ env.BUILDDIR }} + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + name: ${{ env.ARTIFACTNAME }} + path: ${{ env.BUILDDIR }} + deploy: + name: deploy + needs: build + permissions: + contents: read + pages: write + id-token: write + environment: + name: canary + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 + with: + artifact_name: ${{ env.ARTIFACTNAME }} diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml new file mode 100644 index 0000000..101cd45 --- /dev/null +++ b/.github/workflows/linting.yml @@ -0,0 +1,45 @@ +# TOPSTSCHOOL Sphinx (Documentation) Document & Code Linting Workflow +# ================================================================== +# +# Author: Akshay Mestry +# Created on: Sunday, October 27 2024 +# Last updated on: Thursday, October 31 2024 + +name: linting +run-name: Linting initiated after ${{ github.actor }}'s actions + +on: + pull_request: + paths: + - 'docs/**' + - 'requirements*' + +permissions: + contents: read + +env: + SOURCEDIR: docs/source + PYTHONVERSION: 3.12.1 + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + lint: + name: linting + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 + - name: Setup + uses: actions/setup-python@v5 + with: + python-version: ${{ env.PYTHONVERSION }} + cache: pip + - name: Analyze + id: linting + run: | + python -m pip install -Uq pip -rrequirements-dev.txt + echo "Checking code for issues..." + flake8 "$_" && sphinx-lint "$_"