-
Notifications
You must be signed in to change notification settings - Fork 15
154 lines (136 loc) · 5.87 KB
/
Copy pathdocs.yml
File metadata and controls
154 lines (136 loc) · 5.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Docs
# Build the Antora site (with generated operator pages and the
# cross-backend coverage matrix) on every PR and push, and publish to
# GitHub Pages on every push to develop, so the live site tracks the
# last merge. Dokka API bundling is wired in commit 6 of the
# docs-to-Antora migration (see issue #494).
#
# Previously gated the deploy on `release: published`, matching the
# stated intent of "canonical site = latest release" — but this repo's
# actual release process only ever pushes a git tag, never a GitHub
# Release object, so that trigger has never once fired (issue #975).
# Deploying on every push to develop instead — same as
# SKaiNET-transformers' docs.yml — guarantees the site is never more
# than one merge behind, and is simpler than the release-gated version
# nobody was exercising. Revisit this pairing with #976 (versioned
# docs) if "canonical site = latest release" needs to come back as a
# distinct, working thing rather than "whatever's latest on develop".
on:
push:
branches: [ main, develop ]
paths:
- 'docs/**'
- '.github/workflows/docs.yml'
- 'build.gradle.kts'
- 'build-logic/**'
- 'skainet-lang/skainet-lang-core/**'
pull_request:
paths:
- 'docs/**'
- '.github/workflows/docs.yml'
- 'build.gradle.kts'
- 'build-logic/**'
- 'skainet-lang/skainet-lang-core/**'
workflow_dispatch:
concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: true
# Set default permission for all jobs to none. The Pages write grants live on
# deploy-docs alone — build-docs only reads the repo and uploads an artifact.
permissions: {}
jobs:
build-docs:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
# JDK 25 matches the version used by every other workflow in
# this repo. Runs on the RUNNER, not inside the Docker
# container, so the Gradle wrapper cache works and generateDocs
# / dokkaGenerate see the right JDK.
- name: Set up JDK
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
distribution: temurin
java-version: '25'
- name: Cache Gradle
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/libs.versions.toml') }}
restore-keys: |
gradle-${{ runner.os }}-
# Emit the KSP-driven operator fragments and the coverage
# matrix into docs/modules/ROOT/pages/reference/operators/.
# Also generate the full Dokka API aggregate so commit 6 can
# bundle it; running both here means commit 6 is a pure
# workflow-step + Gradle-task-registration change with no
# Gradle re-run cost.
- name: Generate operator docs and Dokka
run: ./gradlew --no-daemon generateDocs dokkaGenerate
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
# The Chromium layer makes the image ~400 MB. First build is
# ~3–5 minutes; subsequent runs are sub-minute via the GHA
# cache. Transformers skipped caching here — this workflow
# improves on that.
- name: Build Antora image
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.0.0
with:
context: docs/.docker
tags: skainet-antora:local
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build Antora site
# Run the container as the runner user (not root) so the
# files under docs/build/site/ are owned by the same user
# that the subsequent Gradle `bundleDokkaIntoSite` step runs
# as. Without this the Copy task fails with
# "Failed to create directory docs/build/site/api" because
# the Antora container otherwise writes the site tree as
# root and Gradle running as runner can't mkdir inside it.
run: |
docker run --rm \
--user "$(id -u):$(id -g)" \
-v "${{ github.workspace }}:/antora" \
--workdir /antora/docs \
skainet-antora:local \
--stacktrace \
antora-playbook.yml
# Bundle Dokka HTML under a sibling `/api/` path of the
# Antora site. Must run AFTER Antora has populated
# docs/build/site/, never before — bundleDokkaIntoSite is a
# plain Copy task that would otherwise pre-create the target
# directory and the later Antora run would wipe it.
- name: Bundle Dokka API into site
run: ./gradlew --no-daemon bundleDokkaIntoSite
- name: Upload artifact
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: docs/build/site
deploy-docs:
# Deploy on every push to develop that touched docs-relevant paths (see
# the `on: push: paths:` filter above) — matches SKaiNET-transformers'
# docs.yml. PR builds and pushes to other branches still run build-docs
# for validation but don't publish.
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
needs: build-docs
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# actions/deploy-pages needs pages:write to publish and id-token:write for
# the OIDC token it exchanges. It does not check the repository out.
permissions:
pages: write
id-token: write
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0