From ed1a665536f5c46b7266103e95b17987939a7c4e Mon Sep 17 00:00:00 2001 From: Okiki Ojo Date: Sun, 24 May 2026 08:50:40 +0000 Subject: [PATCH] ci(release): Keep semantic-release out of registry publishing Rewrite deno.json to the tagged release version before JSR publishes so the workflow no longer depends on deno publish --set-version. Keep the npm build on the explicit RELEASE_VERSION handoff because semantic-release still owns the release tag version. --- .github/workflows/publish.yml | 22 +++++++++++++++++++++- .github/workflows/release.yml | 1 - scripts/build_npm.ts | 4 ++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f4c3c53..79abd55 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -154,8 +154,28 @@ jobs: - name: Install locked dependencies run: deno task deps:ci + - name: Update deno.json with release version + env: + RELEASE_VERSION: ${{ needs.resolve-publish.outputs.version }} + run: >- + deno eval + --allow-env=RELEASE_VERSION + --allow-read=deno.json + --allow-write=deno.json + 'const releaseVersion = Deno.env.get("RELEASE_VERSION"); + if (!releaseVersion) { + throw new Error("Expected RELEASE_VERSION to be set."); + } + + const denoJson = JSON.parse(await Deno.readTextFile("deno.json")); + denoJson.version = releaseVersion; + await Deno.writeTextFile( + "deno.json", + `${JSON.stringify(denoJson, null, 2)}\n`, + );' + - name: Publish to JSR - run: deno publish --set-version "${{ needs.resolve-publish.outputs.version }}" + run: deno publish publish-npm: name: Publish to npm diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 15d18c9..0dcab44 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,7 +64,6 @@ jobs: --package=semantic-release --package=@semantic-release/changelog --package=@semantic-release/commit-analyzer - --package=@semantic-release/exec --package=@semantic-release/git --package=@semantic-release/github --package=@semantic-release/release-notes-generator diff --git a/scripts/build_npm.ts b/scripts/build_npm.ts index f23e5cf..c0adc20 100644 --- a/scripts/build_npm.ts +++ b/scripts/build_npm.ts @@ -12,6 +12,10 @@ import { build, emptyDir } from "jsr:@deno/dnt"; import { format, parse } from 'jsr:@std/semver'; import denoJson from "../deno.json" with { type: "json" }; +// semantic-release remains the release authority for GitHub tags and changelog +// entries, so the tagged commit still carries the pre-release deno.json +// version. npm publishing therefore takes the resolved release version from the +// workflow and injects it here, while local builds still default to deno.json. const packageVersion = resolvePackageVersion(); await emptyDir("./npm"); -- 2.51.2