Skip to content

Commit 751ebdf

Browse files
committed
ci: switch from semantic-release to release-please
Replace semantic-release with release-please to match org-wide release workflow. Uses GitHub App token for PR creation, draft releases with tag workaround, and npm publish via OIDC provenance. - Add release-please-config.json and manifest (v1.1.0) - Add release.yml workflow (release-please + npm publish + undraft) - Remove .releaserc.json and publish.yml (semantic-release) - Remove semantic-release from devDependencies
1 parent 99301ba commit 751ebdf

7 files changed

Lines changed: 112 additions & 1021 deletions

File tree

.github/workflows/publish.yml

Lines changed: 0 additions & 69 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
id-token: write
11+
12+
env:
13+
BUN_VERSION: '1.2'
14+
15+
jobs:
16+
release-please:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
release_created: ${{ steps.release.outputs.release_created }}
20+
tag_name: ${{ steps.release.outputs.tag_name }}
21+
version: ${{ steps.release.outputs.version }}
22+
steps:
23+
- name: Generate GitHub App token
24+
id: app-token
25+
uses: actions/create-github-app-token@v2
26+
with:
27+
app-id: ${{ vars.RELEASE_APP_ID }}
28+
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
29+
30+
- uses: googleapis/release-please-action@v4
31+
id: release
32+
with:
33+
token: ${{ steps.app-token.outputs.token }}
34+
35+
- name: Create git tag for draft release
36+
if: ${{ steps.release.outputs.release_created }}
37+
env:
38+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
39+
run: |
40+
TAG="${{ steps.release.outputs.tag_name }}"
41+
SHA="${{ steps.release.outputs.sha }}"
42+
if gh api "repos/${{ github.repository }}/git/ref/tags/${TAG}" --silent 2>/dev/null; then
43+
echo "Tag ${TAG} already exists, skipping"
44+
else
45+
echo "Creating tag ${TAG} at ${SHA}"
46+
gh api "repos/${{ github.repository }}/git/refs" \
47+
--method POST \
48+
-f "ref=refs/tags/${TAG}" \
49+
-f "sha=${SHA}"
50+
fi
51+
52+
publish-npm:
53+
name: Publish to npm
54+
needs: release-please
55+
if: ${{ needs.release-please.outputs.release_created && !contains(needs.release-please.outputs.tag_name, '-') }}
56+
runs-on: ubuntu-latest
57+
steps:
58+
- uses: actions/checkout@v6
59+
60+
- uses: actions/setup-node@v6
61+
with:
62+
node-version: 24
63+
registry-url: 'https://registry.npmjs.org'
64+
65+
- uses: oven-sh/setup-bun@v2
66+
with:
67+
bun-version: ${{ env.BUN_VERSION }}
68+
69+
- name: Install dependencies
70+
run: bun install --frozen-lockfile
71+
72+
- name: Publish
73+
run: npm publish --provenance --access public
74+
75+
publish-release:
76+
name: Publish Release
77+
needs: [release-please, publish-npm]
78+
runs-on: ubuntu-latest
79+
if: always() && needs.release-please.outputs.release_created
80+
steps:
81+
- name: Publish draft release
82+
env:
83+
GH_TOKEN: ${{ github.token }}
84+
run: gh release edit ${{ needs.release-please.outputs.tag_name }} --repo ${{ github.repository }} --draft=false

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "1.1.0"
3+
}

.releaserc.json

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)