Fix Windows native bundles and manual release publishing

This commit is contained in:
Advait Paliwal
2026-03-24 12:44:15 -07:00
parent 5c3a9bb103
commit 4b82ad8f41
2 changed files with 33 additions and 9 deletions

View File

@@ -108,7 +108,7 @@ jobs:
- version-check
- publish-npm
- build-native-bundles
if: needs.version-check.outputs.should_publish == 'true'
if: needs.version-check.outputs.should_build_release == 'true' && needs.build-native-bundles.result == 'success' && (needs.publish-npm.result == 'success' || needs.publish-npm.result == 'skipped')
runs-on: blacksmith-4vcpu-ubuntu-2404
permissions:
contents: write
@@ -122,7 +122,15 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ needs.version-check.outputs.version }}
run: |
gh release create "v$VERSION" release-assets/* \
--title "v$VERSION" \
--notes "Standalone Feynman bundles for native installation." \
--target "$GITHUB_SHA"
if gh release view "v$VERSION" >/dev/null 2>&1; then
gh release upload "v$VERSION" release-assets/* --clobber
gh release edit "v$VERSION" \
--title "v$VERSION" \
--notes "Standalone Feynman bundles for native installation." \
--draft=false
else
gh release create "v$VERSION" release-assets/* \
--title "v$VERSION" \
--notes "Standalone Feynman bundles for native installation." \
--target "$GITHUB_SHA"
fi

View File

@@ -13,25 +13,41 @@ function fail(message) {
process.exit(1);
}
function resolveCommand(command) {
if (process.platform === "win32" && command === "npm") {
return "npm.cmd";
}
return command;
}
function run(command, args, options = {}) {
const result = spawnSync(command, args, {
const resolvedCommand = resolveCommand(command);
const result = spawnSync(resolvedCommand, args, {
stdio: "inherit",
...options,
});
if (result.error) {
fail(`${resolvedCommand} ${args.join(" ")} failed: ${result.error.message}`);
}
if (result.status !== 0) {
fail(`${command} ${args.join(" ")} failed with code ${result.status ?? 1}`);
fail(`${resolvedCommand} ${args.join(" ")} failed with code ${result.status ?? 1}`);
}
}
function runCapture(command, args, options = {}) {
const result = spawnSync(command, args, {
const resolvedCommand = resolveCommand(command);
const result = spawnSync(resolvedCommand, args, {
encoding: "utf8",
stdio: ["ignore", "pipe", "pipe"],
...options,
});
if (result.error) {
fail(`${resolvedCommand} ${args.join(" ")} failed: ${result.error.message}`);
}
if (result.status !== 0) {
const errorOutput = result.stderr?.trim() || result.stdout?.trim() || "unknown error";
fail(`${command} ${args.join(" ")} failed: ${errorOutput}`);
fail(`${resolvedCommand} ${args.join(" ")} failed: ${errorOutput}`);
}
return result.stdout.trim();
}