Skip to content

Commit 1949039

Browse files
committed
fix: cd
1 parent e914fb4 commit 1949039

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ jobs:
4949
uses: changesets/action@v1
5050
with:
5151
version: bun run version:packages
52-
publish: bun run release:build && bun run release:stage && bun run release:publish
52+
publish: bun run release:ci
5353
commit: "chore: version packages"
5454
title: "chore: version packages"
5555
env:
5656
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
57+
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"release:build": "bun run scripts/release/build-binaries.ts",
1313
"release:stage": "bun run scripts/release/stage-npm.ts",
1414
"release:publish": "bun run scripts/release/publish-npm.ts",
15+
"release:ci": "bun run release:build && bun run release:stage && bun run release:publish",
1516
"release:dry-run": "bun run scripts/release/publish-npm.ts --dry-run"
1617
},
1718
"devDependencies": {

scripts/release/shared.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ async function runCommand(command: string, args: string[], cwd?: string) {
152152
await new Promise<void>((resolve, reject) => {
153153
const child = spawn(command, args, {
154154
cwd,
155+
env: process.env,
155156
stdio: "inherit",
156157
});
157158

@@ -170,6 +171,20 @@ async function runCommand(command: string, args: string[], cwd?: string) {
170171
});
171172
}
172173

174+
async function syncOptionalDependenciesForTarget(spec: TargetSpec) {
175+
await runCommand(
176+
"bun",
177+
[
178+
"install",
179+
"--frozen-lockfile",
180+
"--ignore-scripts",
181+
`--os=${spec.os}`,
182+
`--cpu=${spec.cpu}`,
183+
],
184+
REPO_ROOT,
185+
);
186+
}
187+
173188
function unixLauncher(binaryName: "ralph" | "ralphd") {
174189
return `#!/usr/bin/env bash
175190
set -e
@@ -265,6 +280,7 @@ export async function buildBinaries(
265280
for (const target of targets) {
266281
const spec = getTargetSpec(target);
267282
const targetDir = join(outDir, target);
283+
await syncOptionalDependenciesForTarget(spec);
268284
await rm(targetDir, { recursive: true, force: true });
269285
await mkdir(targetDir, { recursive: true });
270286

@@ -480,6 +496,9 @@ export async function publishDistribution(
480496
console.log(`(dry-run) cwd=${packageDir} bun ${args.join(" ")}`);
481497
continue;
482498
}
499+
if (!process.env.NPM_CONFIG_TOKEN && process.env.NPM_TOKEN) {
500+
process.env.NPM_CONFIG_TOKEN = process.env.NPM_TOKEN;
501+
}
483502
await runCommand("bun", args, packageDir);
484503
}
485504
}

0 commit comments

Comments
 (0)