|
| 1 | +# .github/workflows/build-and-deploy.yml |
| 2 | +# |
| 3 | +# Copyright © 2025 Network Pro Strategies (Network Pro™) |
| 4 | +# SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later |
| 5 | +# This file is part of Network Pro |
| 6 | + |
| 7 | +name: Build Site and Deploy to GH Pages |
| 8 | + |
| 9 | +on: |
| 10 | + release: |
| 11 | + types: [created] |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 15 | +permissions: |
| 16 | + actions: read |
| 17 | + contents: read |
| 18 | + pages: write |
| 19 | + id-token: write |
| 20 | + |
| 21 | +# Allow one concurrent deployment |
| 22 | +concurrency: |
| 23 | + group: 'pages' |
| 24 | + cancel-in-progress: true |
| 25 | + |
| 26 | +jobs: |
| 27 | + check-codeql: |
| 28 | + uses: ./.github/workflows/check-codeql.yml |
| 29 | + |
| 30 | + build: |
| 31 | + needs: check-codeql |
| 32 | + runs-on: ubuntu-24.04 |
| 33 | + |
| 34 | + steps: |
| 35 | + - name: Checkout repository |
| 36 | + uses: actions/checkout@v5 |
| 37 | + with: |
| 38 | + fetch-depth: 0 |
| 39 | + |
| 40 | + - name: Set up Node.js |
| 41 | + uses: actions/setup-node@v5 |
| 42 | + with: |
| 43 | + node-version: 22 |
| 44 | + cache: npm |
| 45 | + cache-dependency-path: package-lock.json |
| 46 | + |
| 47 | + - name: Upgrade npm |
| 48 | + run: | |
| 49 | + corepack enable |
| 50 | + |
| 51 | +
|
| 52 | + - name: Set up Pages |
| 53 | + uses: actions/configure-pages@v5 |
| 54 | + |
| 55 | + - name: Install Node.js dependencies |
| 56 | + run: npm ci |
| 57 | + |
| 58 | + # Begin Material for MkDocs setup |
| 59 | + - name: Set up Python |
| 60 | + uses: actions/setup-python@v6 |
| 61 | + with: |
| 62 | + python-version: '3.13' |
| 63 | + |
| 64 | + - name: Install Python dependencies |
| 65 | + run: pip install -r requirements.txt |
| 66 | + |
| 67 | + # Strict mode disabled for mkdocs-material |
| 68 | + - name: Build MkDocs documentation |
| 69 | + run: mkdocs build |
| 70 | + |
| 71 | + - name: Copy package.json to build directory |
| 72 | + run: cp package.json build/ |
| 73 | + |
| 74 | + - name: Upload artifact |
| 75 | + uses: actions/upload-pages-artifact@v4 |
| 76 | + with: |
| 77 | + path: ./build |
| 78 | + |
| 79 | + deploy: |
| 80 | + needs: [check-codeql, build] |
| 81 | + environment: |
| 82 | + name: github-pages |
| 83 | + url: ${{ steps.deployment.outputs.page_url }} |
| 84 | + runs-on: ubuntu-24.04 |
| 85 | + |
| 86 | + steps: |
| 87 | + - name: Deploy to GitHub Pages |
| 88 | + id: deployment |
| 89 | + uses: actions/deploy-pages@v4 |
0 commit comments