Skip to content

Commit ee93d53

Browse files
committed
chore: add trusted publishing release workflow
1 parent 01f56bc commit ee93d53

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: read
10+
id-token: write
11+
12+
jobs:
13+
publish:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v5
18+
19+
- uses: pnpm/action-setup@v4
20+
with:
21+
version: 10.17.0
22+
23+
- uses: actions/setup-node@v4
24+
with:
25+
node-version: 24
26+
cache: pnpm
27+
registry-url: "https://registry.npmjs.org"
28+
29+
- name: Verify package version matches tag
30+
run: |
31+
PACKAGE_VERSION=$(node -p "require('./packages/skill-doctor/package.json').version")
32+
TAG_VERSION="${GITHUB_REF_NAME#v}"
33+
34+
if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
35+
echo "Tag version ($TAG_VERSION) does not match package version ($PACKAGE_VERSION)."
36+
exit 1
37+
fi
38+
39+
- run: pnpm install --frozen-lockfile
40+
- run: pnpm lint
41+
- run: pnpm typecheck
42+
- run: pnpm test
43+
- run: pnpm release:check
44+
45+
- name: Publish to npm
46+
working-directory: packages/skill-doctor
47+
run: npm publish

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"lint:fix": "oxlint --fix packages/skill-doctor/src packages/skill-doctor/tests",
1616
"format": "oxfmt --write .",
1717
"format:check": "oxfmt --check .",
18+
"release:check": "pnpm --filter skill-doctor build && cd packages/skill-doctor && npm pack --dry-run",
1819
"test": "pnpm -r test",
1920
"typecheck": "pnpm -r typecheck"
2021
},

packages/skill-doctor/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,13 @@
3535
"default": "./dist/index.js"
3636
}
3737
},
38+
"publishConfig": {
39+
"access": "public"
40+
},
3841
"scripts": {
3942
"dev": "tsdown --watch",
4043
"build": "rm -rf dist && NODE_ENV=production tsdown",
44+
"pack:check": "npm pack --dry-run",
4145
"typecheck": "tsc --noEmit",
4246
"test": "pnpm build && vitest run"
4347
},

0 commit comments

Comments
 (0)