diff --git a/.github/instructions/changelog-commits.instructions.md b/.github/instructions/changelog-commits.instructions.md index afecd70..e51d622 100644 --- a/.github/instructions/changelog-commits.instructions.md +++ b/.github/instructions/changelog-commits.instructions.md @@ -281,9 +281,8 @@ required so tooling reliably detects and surfaces the change. ### How semantic-release reads commits This project uses `semantic-release` to calculate versions, create GitHub -releases, and update `changelog.md` from Conventional Commits. Registry -publishing stays outside `semantic-release` in `publish.yml`. The default rules -for this repo are: +releases, and update `changelog.md` from Conventional Commits. The default +rules for this repo are: - `fix` → patch version bump - `feat` → minor version bump @@ -330,8 +329,7 @@ What you can and should do manually: creates the release commit and tag, and publishes the GitHub Release. 4. The published release event triggers `publish.yml`, which runs `deno ci` against the tagged commit and then publishes to **JSR** - (`deno eval` rewrites `deno.json.version` in the ephemeral checkout, then - `deno publish`) and **npm** + (`deno publish --set-version `) and **npm** (`RELEASE_VERSION= deno task build:npm` followed by `npm publish`) in parallel. Re-running a publish job for an already-published version should be safe. @@ -340,8 +338,7 @@ What you can and should do manually: To publish manually: - Verify the release commit: `deno task release:verify` - - JSR: update `deno.json.version` to the release version, then run - `deno ci && deno publish` + - JSR: `deno ci && deno publish --set-version ` - npm: `deno ci && RELEASE_VERSION= deno task build:npm && cd npm && npm publish --access public` ### Writing changelog entries diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7807ece..f4c3c53 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -154,25 +154,8 @@ 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 - '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 + run: deno publish --set-version "${{ needs.resolve-publish.outputs.version }}" publish-npm: name: Publish to npm diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0dcab44..15d18c9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,6 +64,7 @@ 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/readme.md b/readme.md index 477ac3c..463679b 100644 --- a/readme.md +++ b/readme.md @@ -782,10 +782,6 @@ interface TrimSides { This project uses [Conventional Commits](https://www.conventionalcommits.org/) for automated versioning, GitHub releases, and changelog generation via [`semantic-release`](https://semantic-release.gitbook.io/semantic-release/). -`semantic-release` only decides the release version, updates -[`changelog.md`](./changelog.md), and creates the GitHub Release. Registry -publishing stays in [`.github/workflows/publish.yml`](./.github/workflows/publish.yml), -which publishes the tagged release to JSR and npm. | Prefix | Version effect | | ---------------------------- | -------------- | diff --git a/scripts/build_npm.ts b/scripts/build_npm.ts index c0adc20..f9c0094 100644 --- a/scripts/build_npm.ts +++ b/scripts/build_npm.ts @@ -11,11 +11,6 @@ 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");