Skip to content

Commit 06a4bf5

Browse files
authored
Actions: add reusable cross-OS release checks workflow (#66812)
1 parent 6531004 commit 06a4bf5

2 files changed

Lines changed: 326 additions & 0 deletions

File tree

Lines changed: 320 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,320 @@
1+
name: OpenClaw Cross-OS Release Checks (Reusable)
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
ref:
7+
description: Public OpenClaw ref to validate (tag, branch, or full commit SHA)
8+
required: true
9+
type: string
10+
provider:
11+
description: Provider lane to use for onboarding and the end-to-end turn
12+
required: true
13+
type: string
14+
mode:
15+
description: Which release-check lanes to run
16+
required: true
17+
type: string
18+
previous_version:
19+
description: Optional baseline version for the upgrade lane (defaults to npm latest)
20+
required: false
21+
default: ""
22+
type: string
23+
ubuntu_runner:
24+
description: Optional Linux runner label override
25+
required: false
26+
default: ""
27+
type: string
28+
windows_runner:
29+
description: Optional Windows runner label override
30+
required: false
31+
default: ""
32+
type: string
33+
macos_runner:
34+
description: Optional macOS runner label override
35+
required: false
36+
default: ""
37+
type: string
38+
secrets:
39+
OPENAI_API_KEY:
40+
required: false
41+
ANTHROPIC_API_KEY:
42+
required: false
43+
MINIMAX_API_KEY:
44+
required: false
45+
46+
concurrency:
47+
group: openclaw-cross-os-release-checks-${{ inputs.ref }}-${{ inputs.provider }}-${{ inputs.mode }}
48+
cancel-in-progress: false
49+
50+
env:
51+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
52+
NODE_VERSION: "24.x"
53+
PNPM_VERSION: "10.32.1"
54+
OPENCLAW_REPOSITORY: openclaw/openclaw
55+
56+
jobs:
57+
prepare:
58+
runs-on: ubuntu-latest
59+
permissions:
60+
contents: read
61+
outputs:
62+
baseline_file_name: ${{ steps.baseline_metadata.outputs.file_name }}
63+
baseline_spec: ${{ steps.baseline.outputs.value }}
64+
candidate_file_name: ${{ steps.candidate_metadata.outputs.file_name }}
65+
candidate_version: ${{ steps.candidate_metadata.outputs.version }}
66+
matrix: ${{ steps.matrix.outputs.value }}
67+
source_sha: ${{ steps.candidate_metadata.outputs.source_sha }}
68+
steps:
69+
- name: Validate provider secret availability
70+
env:
71+
PROVIDER: ${{ inputs.provider }}
72+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
73+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
74+
MINIMAX_API_KEY: ${{ secrets.MINIMAX_API_KEY }}
75+
run: |
76+
set -euo pipefail
77+
case "${PROVIDER}" in
78+
openai)
79+
[[ -n "${OPENAI_API_KEY}" ]] || { echo "Missing OPENAI_API_KEY secret." >&2; exit 1; }
80+
;;
81+
anthropic)
82+
[[ -n "${ANTHROPIC_API_KEY}" ]] || { echo "Missing ANTHROPIC_API_KEY secret." >&2; exit 1; }
83+
;;
84+
minimax)
85+
[[ -n "${MINIMAX_API_KEY}" ]] || { echo "Missing MINIMAX_API_KEY secret." >&2; exit 1; }
86+
;;
87+
*)
88+
echo "Unsupported provider: ${PROVIDER}" >&2
89+
exit 1
90+
;;
91+
esac
92+
93+
- name: Checkout caller release workflow repo
94+
uses: actions/checkout@v6
95+
with:
96+
fetch-depth: 1
97+
persist-credentials: false
98+
99+
- name: Checkout public source ref
100+
uses: actions/checkout@v6
101+
with:
102+
repository: ${{ env.OPENCLAW_REPOSITORY }}
103+
ref: ${{ inputs.ref }}
104+
path: source
105+
fetch-depth: 0
106+
persist-credentials: false
107+
submodules: recursive
108+
109+
- name: Setup pnpm
110+
uses: pnpm/action-setup@v4
111+
with:
112+
version: ${{ env.PNPM_VERSION }}
113+
run_install: false
114+
115+
- name: Setup Node.js
116+
uses: actions/setup-node@v6
117+
with:
118+
node-version: ${{ env.NODE_VERSION }}
119+
cache: pnpm
120+
cache-dependency-path: source/pnpm-lock.yaml
121+
122+
- name: Build candidate artifact once
123+
env:
124+
OUTPUT_DIR: ${{ runner.temp }}/openclaw-cross-os-release-checks/prepare
125+
run: |
126+
node --disable-warning=ExperimentalWarning scripts/openclaw-cross-os-release-checks.ts \
127+
--prepare-only \
128+
--source-dir source \
129+
--output-dir "${OUTPUT_DIR}"
130+
131+
- name: Resolve baseline package spec
132+
if: ${{ inputs.mode != 'fresh' }}
133+
id: baseline
134+
env:
135+
INPUT_PREVIOUS_VERSION: ${{ inputs.previous_version }}
136+
run: |
137+
set -euo pipefail
138+
if [[ -n "${INPUT_PREVIOUS_VERSION}" ]]; then
139+
echo "value=openclaw@${INPUT_PREVIOUS_VERSION}" >> "$GITHUB_OUTPUT"
140+
exit 0
141+
fi
142+
BASELINE_VERSION="$(npm view openclaw@latest version)"
143+
echo "value=openclaw@${BASELINE_VERSION}" >> "$GITHUB_OUTPUT"
144+
145+
- name: Pack baseline artifact
146+
if: ${{ inputs.mode != 'fresh' }}
147+
env:
148+
BASELINE_SPEC: ${{ steps.baseline.outputs.value }}
149+
OUTPUT_DIR: ${{ runner.temp }}/openclaw-cross-os-release-checks/prepare/baseline
150+
run: |
151+
mkdir -p "${OUTPUT_DIR}"
152+
npm pack --ignore-scripts --json "${BASELINE_SPEC}" --pack-destination "${OUTPUT_DIR}" > "${OUTPUT_DIR}/pack.json"
153+
154+
- name: Capture candidate metadata
155+
id: candidate_metadata
156+
env:
157+
CANDIDATE_JSON: ${{ runner.temp }}/openclaw-cross-os-release-checks/prepare/candidate.json
158+
run: |
159+
node <<'NODE' >>"$GITHUB_OUTPUT"
160+
const fs = require("node:fs");
161+
const payload = JSON.parse(fs.readFileSync(process.env.CANDIDATE_JSON, "utf8"));
162+
process.stdout.write(`file_name=${payload.candidateFileName}\n`);
163+
process.stdout.write(`version=${payload.candidateVersion}\n`);
164+
process.stdout.write(`source_sha=${payload.sourceSha}\n`);
165+
NODE
166+
167+
- name: Capture baseline metadata
168+
if: ${{ inputs.mode != 'fresh' }}
169+
id: baseline_metadata
170+
env:
171+
BASELINE_PACK_JSON: ${{ runner.temp }}/openclaw-cross-os-release-checks/prepare/baseline/pack.json
172+
run: |
173+
node <<'NODE' >>"$GITHUB_OUTPUT"
174+
const fs = require("node:fs");
175+
const payload = JSON.parse(fs.readFileSync(process.env.BASELINE_PACK_JSON, "utf8"));
176+
const entry = Array.isArray(payload) ? payload.at(-1) : null;
177+
if (!entry?.filename) {
178+
throw new Error("Baseline npm pack did not produce a filename.");
179+
}
180+
process.stdout.write(`file_name=${entry.filename}\n`);
181+
NODE
182+
183+
- name: Upload candidate artifact
184+
uses: actions/upload-artifact@v7
185+
with:
186+
name: openclaw-cross-os-release-checks-candidate-${{ github.run_id }}
187+
path: ${{ runner.temp }}/openclaw-cross-os-release-checks/prepare/package/${{ steps.candidate_metadata.outputs.file_name }}
188+
if-no-files-found: error
189+
190+
- name: Upload baseline artifact
191+
if: ${{ inputs.mode != 'fresh' }}
192+
uses: actions/upload-artifact@v7
193+
with:
194+
name: openclaw-cross-os-release-checks-baseline-${{ github.run_id }}
195+
path: ${{ runner.temp }}/openclaw-cross-os-release-checks/prepare/baseline/${{ steps.baseline_metadata.outputs.file_name }}
196+
if-no-files-found: error
197+
198+
- name: Resolve runner matrix
199+
id: matrix
200+
env:
201+
INPUT_MODE: ${{ inputs.mode }}
202+
INPUT_UBUNTU_RUNNER: ${{ inputs.ubuntu_runner }}
203+
INPUT_WINDOWS_RUNNER: ${{ inputs.windows_runner }}
204+
INPUT_MACOS_RUNNER: ${{ inputs.macos_runner }}
205+
VAR_UBUNTU_RUNNER: ${{ vars.OPENCLAW_RELEASE_CHECKS_UBUNTU_RUNNER }}
206+
VAR_WINDOWS_RUNNER: ${{ vars.OPENCLAW_RELEASE_CHECKS_WINDOWS_RUNNER }}
207+
VAR_MACOS_RUNNER: ${{ vars.OPENCLAW_RELEASE_CHECKS_MACOS_RUNNER }}
208+
run: |
209+
node <<'NODE' >>"$GITHUB_OUTPUT"
210+
const pick = (...values) => values.find((value) => typeof value === "string" && value.trim().length > 0)?.trim();
211+
const lanes = (process.env.INPUT_MODE ?? "both") === "both" ? ["fresh", "upgrade"] : [process.env.INPUT_MODE ?? "both"];
212+
const runners = [
213+
{
214+
os_id: "ubuntu",
215+
display_name: "Linux",
216+
runner: pick(process.env.INPUT_UBUNTU_RUNNER, process.env.VAR_UBUNTU_RUNNER, "ubuntu-latest"),
217+
artifact_name: "linux",
218+
},
219+
{
220+
os_id: "windows",
221+
display_name: "Windows",
222+
runner: pick(
223+
process.env.INPUT_WINDOWS_RUNNER,
224+
process.env.VAR_WINDOWS_RUNNER,
225+
"blacksmith-32vcpu-windows-2025",
226+
),
227+
artifact_name: "windows",
228+
},
229+
{
230+
os_id: "macos",
231+
display_name: "macOS",
232+
runner: pick(process.env.INPUT_MACOS_RUNNER, process.env.VAR_MACOS_RUNNER, "macos-latest-xlarge"),
233+
artifact_name: "macos",
234+
},
235+
];
236+
const matrix = {
237+
include: runners.flatMap((runner) => lanes.map((lane) => ({ ...runner, lane }))),
238+
};
239+
process.stdout.write(`value=${JSON.stringify(matrix)}\n`);
240+
NODE
241+
242+
cross_os_release_checks:
243+
name: "${{ matrix.display_name }} / ${{ matrix.lane }}"
244+
needs: prepare
245+
permissions:
246+
contents: read
247+
strategy:
248+
fail-fast: false
249+
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
250+
runs-on: ${{ matrix.runner }}
251+
timeout-minutes: 120
252+
steps:
253+
- name: Checkout caller release workflow repo
254+
uses: actions/checkout@v6
255+
with:
256+
fetch-depth: 1
257+
persist-credentials: false
258+
259+
- name: Setup pnpm
260+
uses: pnpm/action-setup@v4
261+
with:
262+
version: ${{ env.PNPM_VERSION }}
263+
run_install: false
264+
265+
- name: Setup Node.js
266+
uses: actions/setup-node@v6
267+
with:
268+
node-version: ${{ env.NODE_VERSION }}
269+
270+
- name: Download candidate artifact
271+
uses: actions/download-artifact@v8
272+
with:
273+
name: openclaw-cross-os-release-checks-candidate-${{ github.run_id }}
274+
path: ${{ runner.temp }}/openclaw-cross-os-release-checks/candidate
275+
276+
- name: Download baseline artifact
277+
if: ${{ matrix.lane == 'upgrade' }}
278+
uses: actions/download-artifact@v8
279+
with:
280+
name: openclaw-cross-os-release-checks-baseline-${{ github.run_id }}
281+
path: ${{ runner.temp }}/openclaw-cross-os-release-checks/baseline
282+
283+
- name: Run cross-OS release checks
284+
shell: bash
285+
env:
286+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
287+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
288+
MINIMAX_API_KEY: ${{ secrets.MINIMAX_API_KEY }}
289+
OPENCLAW_RELEASE_CHECK_OS: ${{ matrix.os_id }}
290+
OPENCLAW_RELEASE_CHECK_RUNNER: ${{ matrix.runner }}
291+
run: |
292+
node --disable-warning=ExperimentalWarning scripts/openclaw-cross-os-release-checks.ts \
293+
--candidate-tgz "$RUNNER_TEMP/openclaw-cross-os-release-checks/candidate/${{ needs.prepare.outputs.candidate_file_name }}" \
294+
--candidate-version "${{ needs.prepare.outputs.candidate_version }}" \
295+
--source-sha "${{ needs.prepare.outputs.source_sha }}" \
296+
--baseline-spec "${{ needs.prepare.outputs.baseline_spec }}" \
297+
--baseline-tgz "$RUNNER_TEMP/openclaw-cross-os-release-checks/baseline/${{ needs.prepare.outputs.baseline_file_name }}" \
298+
--provider "${{ inputs.provider }}" \
299+
--mode "${{ matrix.lane }}" \
300+
--output-dir "$RUNNER_TEMP/openclaw-cross-os-release-checks/${{ matrix.artifact_name }}-${{ matrix.lane }}"
301+
302+
- name: Summarize release checks
303+
if: always()
304+
shell: bash
305+
env:
306+
SUMMARY_PATH: ${{ runner.temp }}/openclaw-cross-os-release-checks/${{ matrix.artifact_name }}-${{ matrix.lane }}/summary.md
307+
run: |
308+
if [[ -f "${SUMMARY_PATH}" ]]; then
309+
cat "${SUMMARY_PATH}" >> "$GITHUB_STEP_SUMMARY"
310+
else
311+
echo "No summary generated." >> "$GITHUB_STEP_SUMMARY"
312+
fi
313+
314+
- name: Upload release-check artifacts
315+
if: always()
316+
uses: actions/upload-artifact@v7
317+
with:
318+
name: openclaw-cross-os-release-checks-${{ matrix.artifact_name }}-${{ matrix.lane }}-${{ github.run_id }}
319+
path: ${{ runner.temp }}/openclaw-cross-os-release-checks/${{ matrix.artifact_name }}-${{ matrix.lane }}
320+
if-no-files-found: error

‎docs/reference/RELEASING.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ OpenClaw has three public release lanes:
4343
- Run `pnpm release:check` before every tagged release
4444
- Release checks now run in a separate manual workflow:
4545
`OpenClaw Release Checks`
46+
- Cross-OS install and upgrade runtime validation is dispatched from the
47+
private caller workflow
48+
`openclaw/releases-private/.github/workflows/openclaw-cross-os-release-checks.yml`,
49+
which invokes the reusable public workflow
50+
`.github/workflows/openclaw-cross-os-release-checks-reusable.yml`
4651
- This split is intentional: keep the real npm release path short,
4752
deterministic, and artifact-focused, while slower live checks stay in their
4853
own lane so they do not stall or block publish
@@ -165,6 +170,7 @@ documented and operator-visible.
165170

166171
- [`.github/workflows/openclaw-npm-release.yml`](https://github.com/openclaw/openclaw/blob/main/.github/workflows/openclaw-npm-release.yml)
167172
- [`.github/workflows/openclaw-release-checks.yml`](https://github.com/openclaw/openclaw/blob/main/.github/workflows/openclaw-release-checks.yml)
173+
- [`.github/workflows/openclaw-cross-os-release-checks-reusable.yml`](https://github.com/openclaw/openclaw/blob/main/.github/workflows/openclaw-cross-os-release-checks-reusable.yml)
168174
- [`scripts/openclaw-npm-release-check.ts`](https://github.com/openclaw/openclaw/blob/main/scripts/openclaw-npm-release-check.ts)
169175
- [`scripts/package-mac-dist.sh`](https://github.com/openclaw/openclaw/blob/main/scripts/package-mac-dist.sh)
170176
- [`scripts/make_appcast.sh`](https://github.com/openclaw/openclaw/blob/main/scripts/make_appcast.sh)

0 commit comments

Comments
 (0)