Workflow file for this run
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
# .github/workflows/build-and-deploy.yml | |
# | |
# Copyright © 2025 Network Pro Strategies (Network Pro™) | |
# SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later | |
# This file is part of Network Pro | |
name: Build Site and Deploy to GH Pages | |
on: | |
release: | |
types: [created] | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow one concurrent deployment | |
concurrency: | |
group: 'build-and-publish' | |
cancel-in-progress: true | |
jobs: | |
check-codeql: | |
name: Check CodeQL Analysis | |
runs-on: ubuntu-24.04 | |
# Continue workflow even if this job fails due to inability to find and/or check CodeQL workflow | |
continue-on-error: true | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up GitHub CLI | |
run: sudo apt-get install gh | |
- name: Check CodeQL Workflow | |
env: | |
GH_TOKEN: ${{ secrets.NWPRO_ACTION }} | |
run: | | |
gh run list --workflow "CodeQL" --json conclusion --jq '.[0].conclusion' > codeql_status.txt | |
CODEQL_STATUS=$(cat codeql_status.txt) | |
if [[ "$CODEQL_STATUS" != "success" ]]; then | |
echo "CodeQL Analysis did not succeed. Exiting..." | |
exit 1 | |
fi | |
rm codeql_status.txt | |
build: | |
needs: check-codeql | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
check-latest: true | |
cache: npm | |
cache-dependency-path: package-lock.json | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Install Node.js dependencies | |
run: npm ci | |
# Begin MkDocs setup | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.13' | |
- name: Install MkDocs and plugins | |
run: | | |
pip install mkdocs mkdocs-material mkdocs-material-extensions mkdocs-get-deps | |
- name: Freeze Python dependencies (for diagnostics) | |
run: pip freeze > freeze.txt | |
- name: Upload pip freeze snapshot | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pip-freeze-ci | |
path: freeze.txt | |
# Strict mode disabled for mkdocs-material | |
- name: Build MkDocs documentation | |
run: mkdocs build | |
- name: Copy package.json to build directory | |
run: cp package.json build/ | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./build | |
deploy: | |
needs: [check-codeql, build] | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |