Skip to content

Commit e73148b

Browse files
committed
workflows: docs: add
Create a custom workflow for deploying our documentation to GitHub Pages. This allows us to retain the original YAML-to-documentation generation process we've used in the past, and stops us from relying solely on files already being on the main branch for documentation build and review. We have to incorporate two new community actions for this: 1. `peaceiris/actions-gh-pages`, for deploying the actual docs using a `gh-pages` branch (which will be created after the first merge to main) 2. `rossjrew/pr-preview-action`, for creating docs previews so we're able to review the changes before merge. Comments will be posted on the PR providing preview links. AI-Generated: Uses Claude Sonnet 5 Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
1 parent d7eb49c commit e73148b

1 file changed

Lines changed: 85 additions & 0 deletions

File tree

.github/workflows/docs.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# SPDX-FileCopyrightText: 2026 The RISE Project
2+
# SPDX-License-Identifier: MIT
3+
4+
name: Build and deploy documentation
5+
6+
on:
7+
push:
8+
branches: [main]
9+
paths:
10+
- "docs/**"
11+
pull_request:
12+
types: [opened, synchronize, reopened, closed]
13+
workflow_dispatch:
14+
15+
concurrency:
16+
group: docs-${{ github.ref }}
17+
18+
jobs:
19+
preview:
20+
if: github.event_name == 'pull_request'
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: write
24+
pull-requests: write
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- uses: actions/setup-python@v5
29+
if: github.event.action != 'closed'
30+
with:
31+
python-version: '3'
32+
33+
- name: Install package doc generator dependencies
34+
if: github.event.action != 'closed'
35+
run: pip install -r docs/requirements.txt
36+
37+
- name: Generate package pages from YAML
38+
if: github.event.action != 'closed'
39+
run: python docs/packages/generate_packages_doc.py
40+
41+
- name: Build with Jekyll
42+
if: github.event.action != 'closed'
43+
uses: actions/jekyll-build-pages@v1
44+
with:
45+
source: ./docs
46+
destination: ./_site
47+
48+
# Auto-detects deploy vs. removal from the pull_request event action,
49+
# so this same step both publishes updates and tears down the preview
50+
# when the PR is closed.
51+
- name: Deploy or remove PR preview
52+
uses: rossjrw/pr-preview-action@v1
53+
with:
54+
source-dir: ./_site
55+
56+
deploy:
57+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
58+
runs-on: ubuntu-latest
59+
permissions:
60+
contents: write
61+
steps:
62+
- uses: actions/checkout@v4
63+
64+
- uses: actions/setup-python@v5
65+
with:
66+
python-version: '3'
67+
68+
- name: Install package doc generator dependencies
69+
run: pip install -r docs/requirements.txt
70+
71+
- name: Generate package pages from YAML
72+
run: python docs/packages/generate_packages_doc.py
73+
74+
- name: Build with Jekyll
75+
uses: actions/jekyll-build-pages@v1
76+
with:
77+
source: ./docs
78+
destination: ./_site
79+
80+
- name: Deploy to GitHub Pages
81+
uses: peaceiris/actions-gh-pages@v4
82+
with:
83+
github_token: ${{ secrets.GITHUB_TOKEN }}
84+
publish_dir: ./_site
85+
keep_files: true

0 commit comments

Comments
 (0)