@@ -30,32 +30,93 @@ permissions:
3030 contents : write
3131 id-token : write
3232
33- env :
34- DENO_VERSION : latest
35- NPM_DIR : ./npm
36-
3733jobs :
3834 release :
3935 runs-on : ubuntu-latest
36+ env :
37+ RELEASE_BUMP : ${{ inputs.bump }}
38+ RELEASE_VERSION : ${{ inputs.version }}
39+ RELEASE_PUBLISH : ${{ inputs.publish }}
4040 steps :
4141 - uses : actions/checkout@v6
4242 with :
4343 fetch-depth : 0
4444
45- - uses : denoland/setup-deno@v2
46- with :
47- deno-version : ${{ env.DENO_VERSION }}
48-
4945 - uses : actions/setup-node@v6
5046 with :
51- node-version : 24
47+ node-version : lts
5248 registry-url : https://registry.npmjs.org
5349
54- - run : deno run -A scripts/pipeline.ts release
50+ - uses : denoland/setup-deno@v2
51+ with :
52+ deno-version : lts
53+
54+ - name : Resolve release version
55+ id : version
56+ run : deno run -A scripts/release-helper.ts resolve >> "$GITHUB_OUTPUT"
57+
58+ - name : Ensure release tag does not already exist
59+ shell : bash
60+ run : |
61+ set -euo pipefail
62+ git fetch --tags --force
63+ if git rev-parse --verify "refs/tags/${{ steps.version.outputs.tag }}" >/dev/null 2>&1; then
64+ echo "::error::Tag already exists: ${{ steps.version.outputs.tag }}"
65+ exit 1
66+ fi
67+
68+ - name : Extract release notes from changelog
5569 env :
56- RELEASE_BUMP : ${{ inputs.bump }}
57- RELEASE_VERSION : ${{ inputs.version }}
58- RELEASE_PUBLISH : ${{ inputs.publish }}
59- NPM_DIR : ${{ env.NPM_DIR }}
60- GITHUB_TOKEN : ${{ github.token }}
61- NODE_AUTH_TOKEN : " "
70+ RELEASE_VERSION : ${{ steps.version.outputs.version }}
71+ run : |
72+ export RELEASE_NOTES_FILE="$RUNNER_TEMP/release-notes.md"
73+ deno run -A scripts/release-helper.ts notes
74+
75+ - name : Sync version files
76+ env :
77+ RELEASE_VERSION : ${{ steps.version.outputs.version }}
78+ run : |
79+ npm version "$RELEASE_VERSION" --no-git-tag-version --allow-same-version
80+ deno run -A scripts/sync-package-metadata.ts
81+
82+ - name : Validate npm package contents
83+ run : npm pack --dry-run
84+
85+ - if : env.RELEASE_PUBLISH != 'true'
86+ name : Run publish dry-runs
87+ run : |
88+ set -euo pipefail
89+ deno publish --dry-run --allow-dirty
90+ npm publish --provenance --dry-run
91+
92+ - if : env.RELEASE_PUBLISH == 'true'
93+ name : Commit and tag release
94+ shell : bash
95+ run : |
96+ set -euo pipefail
97+ git config user.name github-actions[bot]
98+ git config user.email 41898282+github-actions[bot]@users.noreply.github.com
99+ git add package.json deno.json
100+
101+ if git diff --cached --quiet; then
102+ echo "::error::No version changes to commit"
103+ exit 1
104+ fi
105+
106+ git commit -m "chore(release): ${{ steps.version.outputs.tag }}"
107+ git tag -a "${{ steps.version.outputs.tag }}" -m "Release ${{ steps.version.outputs.tag }}"
108+ git push origin HEAD
109+ git push origin "${{ steps.version.outputs.tag }}"
110+
111+ - if : env.RELEASE_PUBLISH == 'true'
112+ name : Create GitHub release
113+ env :
114+ GH_TOKEN : ${{ github.token }}
115+ run : gh release create "${{ steps.version.outputs.tag }}" --notes-file "$RUNNER_TEMP/release-notes.md"
116+
117+ - if : env.RELEASE_PUBLISH == 'true'
118+ name : Publish to JSR and npm
119+ run : |
120+ set -euo pipefail
121+ deno publish
122+ npm publish --provenance
0 commit comments