Skip to content

Commit 65dc5e6

Browse files
committed
feat(release): allow native build profile override
1 parent 68a6eb6 commit 65dc5e6

4 files changed

Lines changed: 47 additions & 21 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ on:
1212
required: true
1313
type: boolean
1414
default: true
15+
profile:
16+
description: "Native binary build profile. Auto keeps releases optimized and previews in debug mode."
17+
required: true
18+
type: choice
19+
options:
20+
- auto
21+
- release
22+
- debug
23+
default: auto
1524

1625
concurrency:
1726
group: publish-${{ github.ref }}
@@ -35,6 +44,7 @@ jobs:
3544
npm_tag: ${{ steps.ctx.outputs.npm_tag }}
3645
sha: ${{ steps.ctx.outputs.sha }}
3746
latest: ${{ steps.ctx.outputs.latest }}
47+
build_profile: ${{ steps.mode.outputs.profile }}
3848
steps:
3949
- uses: actions/checkout@v4
4050
with:
@@ -49,6 +59,26 @@ jobs:
4959
- id: ctx
5060
name: Resolve publish context
5161
run: pnpm --filter=publish exec tsx src/ci/bin.ts context-output
62+
- id: mode
63+
name: Resolve native build profile
64+
env:
65+
REQUESTED_PROFILE: ${{ inputs.profile }}
66+
TRIGGER: ${{ steps.ctx.outputs.trigger }}
67+
run: |
68+
set -euo pipefail
69+
profile="${REQUESTED_PROFILE:-auto}"
70+
if [ "$profile" = "auto" ]; then
71+
if [ "$TRIGGER" = "release" ]; then
72+
profile="release"
73+
else
74+
profile="debug"
75+
fi
76+
fi
77+
case "$profile" in
78+
release|debug) ;;
79+
*) echo "invalid native build profile: $profile" >&2; exit 2 ;;
80+
esac
81+
echo "profile=$profile" >> "$GITHUB_OUTPUT"
5282
5383
wasm-commands:
5484
name: WASM Commands
@@ -121,23 +151,14 @@ jobs:
121151
with:
122152
name: agentos-${{ matrix.platform }}
123153
keep-state: ${{ contains(matrix.runner, 'self-hosted') }}
124-
- name: Resolve build profile
125-
id: mode
126-
run: |
127-
set -euo pipefail
128-
if [ "${{ needs.context.outputs.trigger }}" = "release" ]; then
129-
echo "profile=release" >> "$GITHUB_OUTPUT"
130-
else
131-
echo "profile=debug" >> "$GITHUB_OUTPUT"
132-
fi
133154
- name: Build linux artifacts
134155
uses: docker/build-push-action@v6
135156
with:
136157
context: .
137158
file: docker/build/linux-gnu.Dockerfile
138159
build-args: |
139160
TARGET=${{ matrix.target }}
140-
BUILD_PROFILE=${{ steps.mode.outputs.profile }}
161+
BUILD_PROFILE=${{ needs.context.outputs.build_profile }}
141162
CACHE_PLATFORM=${{ matrix.platform }}
142163
RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
143164
LINUX_GNU_LLVM_VERSION=${{ env.LINUX_GNU_LLVM_VERSION }}
@@ -197,15 +218,6 @@ jobs:
197218
keep-state: true
198219
- name: Log in to ghcr.io
199220
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
200-
- name: Compute build profile
201-
id: mode
202-
run: |
203-
set -euo pipefail
204-
if [ "${{ needs.context.outputs.trigger }}" = "release" ]; then
205-
echo "profile=release" >> "$GITHUB_OUTPUT"
206-
else
207-
echo "profile=debug" >> "$GITHUB_OUTPUT"
208-
fi
209221
- name: Cross-compile via osxcross
210222
uses: docker/build-push-action@v6
211223
with:
@@ -214,7 +226,7 @@ jobs:
214226
build-args: |
215227
TARGET=${{ matrix.target }}
216228
CLANG=${{ matrix.clang }}
217-
BUILD_PROFILE=${{ steps.mode.outputs.profile }}
229+
BUILD_PROFILE=${{ needs.context.outputs.build_profile }}
218230
CACHE_PLATFORM=${{ matrix.platform }}
219231
RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
220232
tags: agentos-darwin-${{ matrix.platform }}

CLAUDE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,9 @@ custom host-syscall imports. Treat that target as **native POSIX**;
226226
- The release workflow must build and stage the native sidecar binaries,
227227
runtime-sidecar binaries, registry WASM commands, and pyodide assets before
228228
publish.
229+
- For an urgent release, use `just release-fast --patch` (or pass
230+
`--profile debug` to `just release`). This still rebuilds every release
231+
artifact, but publishes larger, unoptimized debug native binaries.
229232
- `scripts/verify-fixed-versions.mjs` must pass in the committed tree.
230233

231234
## Docs

justfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ set positional-arguments := true
33
release *args:
44
pnpm --filter=publish release "$@"
55

6+
# Emergency release path: compile larger, slower debug sidecars.
7+
release-fast *args:
8+
pnpm --filter=publish release --profile debug "$@"
9+
610
# Cut a release-preview (debug build, npm-only, branch dist-tag) — see the
711
# release-preview skill for the end-to-end flow.
812
release-preview REF:

scripts/publish/src/local/cut-release.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ interface CliOpts {
6161
dryRun?: boolean;
6262
yes?: boolean;
6363
skipChecks?: boolean;
64+
profile?: string;
6465
}
6566

6667
async function main() {
@@ -77,10 +78,15 @@ async function main() {
7778
.option("--dry-run", "Resolve and print the release plan without triggering the workflow")
7879
.option("-y, --yes", "Skip interactive confirmation")
7980
.option("--skip-checks", "Skip local type-check fail-fast")
81+
.option("--profile <profile>", "Native binary build profile (release or debug)", "release")
8082
.parse();
8183

8284
const opts = program.opts<CliOpts>();
8385
const repoRoot = findRepoRoot();
86+
const profile = opts.profile ?? "release";
87+
if (profile !== "release" && profile !== "debug") {
88+
throw new Error(`invalid --profile ${profile}; expected release or debug`);
89+
}
8490

8591
// 1. Resolve version.
8692
const version = await resolveVersion({
@@ -107,6 +113,7 @@ async function main() {
107113
console.log("Release plan");
108114
console.log(` Version: ${version}`);
109115
console.log(` Latest: ${latest}`);
116+
console.log(` Profile: ${profile}`);
110117
console.log(` Branch: ${branch.trim()}`);
111118
console.log(` Previous: ${latestGit ?? "(none)"}`);
112119
if (opts.dryRun) console.log(" Dry run: no workflow trigger");
@@ -150,7 +157,7 @@ async function main() {
150157
await $({
151158
stdio: "inherit",
152159
cwd: repoRoot,
153-
})`gh workflow run .github/workflows/publish.yaml -f version=${version} -f latest=${latestFlag} --ref ${currentBranch}`;
160+
})`gh workflow run .github/workflows/publish.yaml -f version=${version} -f latest=${latestFlag} -f profile=${profile} --ref ${currentBranch}`;
154161

155162
const { stdout: repo } =
156163
await $`gh repo view --json nameWithOwner -q .nameWithOwner`;

0 commit comments

Comments
 (0)