Skip to content

Commit b1fd900

Browse files
authored
Add docs build and deploy workflow (#9)
1 parent 5fa6b69 commit b1fd900

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

‎.github/workflows/build_and_deploy.yml‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,30 @@ concurrency:
1010
group: build_and_deploy
1111
cancel-in-progress: false
1212

13+
env:
14+
# Tag of edgcpp/compiler whose documentation is published at
15+
# https://edgcpp.org/doc/. Bump this to publish a newer release's docs.
16+
COMPILER_DOC_REF: '7.0'
17+
1318
jobs:
1419
test:
1520
runs-on: ubuntu-latest
1621
steps:
1722
- uses: actions/checkout@v5
23+
- name: Build compiler documentation
24+
run: |
25+
# Fetch only doc/ at the tag; a full checkout of the tree is over 3 GB.
26+
git -c advice.detachedHead=false clone --depth 1 \
27+
--branch "$COMPILER_DOC_REF" --filter=blob:none --sparse \
28+
https://github.com/edgcpp/compiler.git /tmp/compiler
29+
git -C /tmp/compiler sparse-checkout set doc
30+
docker run --rm \
31+
-v /tmp/compiler:/work \
32+
-w /work/doc \
33+
edgcpp/sphinx-env:latest \
34+
make dirhtml
35+
mkdir -p doc
36+
cp -a /tmp/compiler/doc/build/dirhtml/. doc/
1837
- uses: ruby/setup-ruby@v1
1938
with:
2039
ruby-version: '4.0'
@@ -29,6 +48,20 @@ jobs:
2948
contents: write
3049
steps:
3150
- uses: actions/checkout@v5
51+
- name: Build compiler documentation
52+
run: |
53+
# Fetch only doc/ at the tag; a full checkout of the tree is over 3 GB.
54+
git -c advice.detachedHead=false clone --depth 1 \
55+
--branch "$COMPILER_DOC_REF" --filter=blob:none --sparse \
56+
https://github.com/edgcpp/compiler.git /tmp/compiler
57+
git -C /tmp/compiler sparse-checkout set doc
58+
docker run --rm \
59+
-v /tmp/compiler:/work \
60+
-w /work/doc \
61+
edgcpp/sphinx-env:latest \
62+
make dirhtml
63+
mkdir -p doc
64+
cp -a /tmp/compiler/doc/build/dirhtml/. doc/
3265
- uses: ruby/setup-ruby@v1
3366
with:
3467
ruby-version: '4.0'
@@ -44,6 +77,10 @@ jobs:
4477
find . -maxdepth 1 ! -name '_site' ! -name '.git' -exec rm -rf {} \;
4578
mv _site/* .
4679
rm -r _site/
80+
# Serve master as-is. Without this, GitHub Pages runs Jekyll over it
81+
# again, which drops the documentation's doc/_static/ and
82+
# doc/_sources/ directories.
83+
touch .nojekyll
4784
git config --global user.name "GitHub Actions"
4885
git config --global user.email "actions@edgcpp.org"
4986
git add .

‎_config.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,10 @@ exclude:
2424
- README.md
2525
- CLAUDE.md
2626
- AGENTS.md
27+
28+
# Keep the Sphinx output directories that the compiler documentation build
29+
# copies into doc/ (Jekyll skips names that start with an underscore).
30+
include:
31+
- _static
32+
- _sources
33+
- _images

0 commit comments

Comments
 (0)