Skip to content

v1.0.1

v1.0.1 #2

# .github/workflows/build-and-deploy.yml
#
# 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: Authenticate GitHub CLI
env:
GH_PAT: ${{ secrets.GH_PAT }}
run: echo "${{ secrets.GH_PAT }}" | gh auth login --with-token
- name: Check CodeQL Workflow
env:
GH_PAT: ${{ secrets.GH_PAT }}
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
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
check-latest: true
cache: npm
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Cache Node.js modules
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-lts-${{ hashFiles('package-lock.json', 'package.json', '.npmrc') }}
restore-keys: |
${{ runner.os }}-node-lts-build-
${{ runner.os }}-node-lts-
${{ runner.os }}-
- name: Install Node.js dependencies
run: npm ci
# MkDocs Integration Begins
- 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 mkdocs-rss-plugin
# Strict mode temporarily disabled as workaround for mkdocs-material
- name: Build MkDocs documentation
run: mkdocs build
# MkDocs Integration Ends
- 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