diff --git a/.github/workflows/promote_to_release.yml b/.github/workflows/promote_to_release.yml index 2193e3c7aa7b64..0b528fef350514 100644 --- a/.github/workflows/promote_to_release.yml +++ b/.github/workflows/promote_to_release.yml @@ -46,20 +46,8 @@ jobs: Expand-Archive -Path "denort-windows.zip" -DestinationPath "." - name: Run patchver for Windows - shell: pwsh run: | - deno install -g -A -n patchver https://deno.land/x/patchver@0.2.0/cli.ts - $CHANNEL="${{github.event.inputs.releaseKind}}" - # Patch deno.exe - Move-Item -Path "deno.exe" -Destination "deno_original.exe" - patchver "deno_original.exe" "deno.exe" $CHANNEL - # Patch denort.exe - Move-Item -Path "denort.exe" -Destination "denort_original.exe" - patchver "denort_original.exe" "denort.exe" $CHANNEL - - # Rename files to match expected pattern - Move-Item -Path "deno.exe" -Destination "deno-x86_64-pc-windows-msvc-$CHANNEL.exe" - Move-Item -Path "denort.exe" -Destination "denort-x86_64-pc-windows-msvc-$CHANNEL.exe" + deno run -A ./tools/release/promote_to_release_windows.ts ${{github.event.inputs.releaseKind}} - name: Authenticate with Azure uses: azure/login@v1 diff --git a/tools/release/promote_to_release.ts b/tools/release/promote_to_release.ts index 9478a5162723fa..f335941d6951bb 100755 --- a/tools/release/promote_to_release.ts +++ b/tools/release/promote_to_release.ts @@ -5,7 +5,7 @@ import { $ } from "jsr:@david/dax@0.41.0"; import { gray } from "jsr:@std/fmt@1/colors"; -import { patchver } from "jsr:@deno/patchver@0.2.0"; +import { patchver } from "jsr:@deno/patchver@0.3.0"; const SUPPORTED_TARGETS = [ "aarch64-apple-darwin", diff --git a/tools/release/promote_to_release_windows.ts b/tools/release/promote_to_release_windows.ts new file mode 100644 index 00000000000000..9f05b67ff94540 --- /dev/null +++ b/tools/release/promote_to_release_windows.ts @@ -0,0 +1,36 @@ +#!/usr/bin/env -S deno run -A +// Copyright 2018-2025 the Deno authors. MIT license. + +// deno-lint-ignore-file no-console + +import { patchver } from "jsr:@deno/patchver@0.3.0"; + +const CHANNEL = Deno.args[0]; +if (CHANNEL !== "rc" && CHANNEL !== "lts") { + throw new Error(`Invalid channel: ${CHANNEL}`); +} + +const BINARIES = ["deno.exe", "denort.exe"]; + +async function patchBinary(inputPath: string, channel: string) { + console.log(`Patching ${inputPath}...`); + + const input = await Deno.readFile(inputPath); + const output = patchver(input, channel); + + // Extract filename without extension and create output name + const baseName = inputPath.replace(/\.exe$/, ""); + const outputPath = `${baseName}-x86_64-pc-windows-msvc-${channel}.exe`; + + await Deno.writeFile(outputPath, output); + console.log(`Created ${outputPath}`); +} + +async function main() { + for (const binary of BINARIES) { + await patchBinary(binary, CHANNEL); + } + console.log("All Windows binaries patched successfully!"); +} + +await main();