()
| 352 | }; |
| 353 | |
| 354 | const main = async () => { |
| 355 | const options = parseArgs(process.argv.slice(2)); |
| 356 | const version = await readVersion(); |
| 357 | const tag = `v${version}`; |
| 358 | const refTag = resolveTagFromEnvironment(); |
| 359 | const channel = resolveChannel(version); |
| 360 | |
| 361 | validateVersion(version); |
| 362 | |
| 363 | if (refTag && refTag !== tag) { |
| 364 | throw new Error(`GitHub tag ${refTag} does not match ${versionPackagePath} version ${version}`); |
| 365 | } |
| 366 | |
| 367 | if (options.mode === "publish-only") { |
| 368 | await locateBuiltArtifacts(version); |
| 369 | await runCommand({ |
| 370 | command: "bun", |
| 371 | args: ["run", "src/build.ts", "publish", channel], |
| 372 | cwd: cliRoot, |
| 373 | }); |
| 374 | return; |
| 375 | } |
| 376 | |
| 377 | let wrapperArchivePath: string; |
| 378 | if (options.skipBuild) { |
| 379 | wrapperArchivePath = await locateBuiltArtifacts(version); |
| 380 | } else { |
| 381 | await rm(releaseDir, { recursive: true, force: true }); |
| 382 | await mkdir(releaseDir, { recursive: true }); |
| 383 | |
| 384 | await runCommand({ |
| 385 | command: "bun", |
| 386 | args: ["run", "src/build.ts", "binary"], |
| 387 | cwd: cliRoot, |
| 388 | }); |
| 389 | |
| 390 | await runCommand({ |
| 391 | command: "bun", |
| 392 | args: ["run", "src/build.ts", "release-assets"], |
| 393 | cwd: cliRoot, |
| 394 | }); |
| 395 | |
| 396 | wrapperArchivePath = await packWrapperPackage(); |
| 397 | } |
| 398 | |
| 399 | const assetPaths = await collectReleaseAssetPaths(wrapperArchivePath); |
| 400 | |
| 401 | console.log(`Prepared executor@${version} for ${channel}`); |
| 402 | for (const assetPath of assetPaths) { |
| 403 | console.log(`- ${assetPath}`); |
| 404 | } |
| 405 | |
| 406 | if (options.mode === "dry-run") { |
| 407 | return; |
| 408 | } |
| 409 | |
| 410 | await syncGitHubRelease({ |
| 411 | tag, |
no test coverage detected