Skip to content

Merge pull request #24 from TheMaxMur/develop #49

Merge pull request #24 from TheMaxMur/develop

Merge pull request #24 from TheMaxMur/develop #49

Workflow file for this run

# SPDX-License-Identifier: AGPL-3.0-only
# Copyright (C) 2026 RS-Key contributors
# Builds the *versioned* documentation site (mdBook + mdbook-mermaid) and
# publishes it to GitHub Pages via the official Pages deployment flow.
#
# main -> site root (the default version)
# develop -> /develop/
# v* tags -> /<tag>/ (e.g. /v0.1.0/)
#
# Every run rebuilds all versions from their own git refs (see
# scripts/pages/build-site.sh) and replaces the published site, so the version
# set always matches the live branches + tags. Branch pushes are path-filtered
# to docs changes; tag pushes always run (GitHub does not apply `paths` to tag
# pushes). Versioning takes effect for tags created after this workflow lands;
# existing tags are picked up on the next main/develop docs push.
#
# One-time repo setup: Settings -> Pages -> Build and deployment -> Source =
# "GitHub Actions". The built site is never committed to the repo.
name: pages
on:
push:
branches: [main, develop]
paths:
- "docs/**"
- "book.toml"
- ".github/workflows/pages.yml"
- "scripts/pages/**"
tags:
- "v*"
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
# Allow one in-flight Pages deployment; don't cancel a running one.
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0 # all branches + tags, so every version can be built
- uses: DeterminateSystems/nix-installer-action@ef8a148080ab6020fd15196c2084a2eea5ff2d25 # v22
- uses: nix-community/cache-nix-action@7df957e333c1e5da7721f60227dbba6d06080569 # v7.0.2
with:
primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.lock') }}
restore-prefixes-first-match: nix-${{ runner.os }}-
- uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
id: pages
# mdbook + mdbook-mermaid only (not the firmware dev shell), pinned to the
# flake's nixpkgs via --inputs-from so the versions match the dev shell.
# PAGES_BASE comes from configure-pages so the per-version site-url is
# correct regardless of the repo name.
- name: Build the versioned site
env:
PAGES_BASE: ${{ steps.pages.outputs.base_path }}/
run: |
nix shell --inputs-from . nixpkgs#mdbook nixpkgs#mdbook-mermaid -c \
./scripts/pages/build-site.sh site
- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: site
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0