-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (49 loc) · 1.51 KB
/
Copy pathpublish.yml
File metadata and controls
60 lines (49 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Publish
on:
push:
tags:
- "v*"
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write # needed for GitHub Release creation
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Type check
run: bunx tsc --noEmit
- name: Test
run: bun test
- name: Verify version matches tag
run: |
TAG=${GITHUB_REF#refs/tags/v}
PKG=$(node -p "require('./package.json').version")
if [ "$TAG" != "$PKG" ]; then
echo "Tag v$TAG does not match package.json version $PKG"
exit 1
fi
echo "Version verified: $PKG"
- uses: actions/setup-node@v6
with:
node-version: 22
registry-url: https://registry.npmjs.org
- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Extract changelog for this version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
awk "/^## \[${VERSION}\]/{found=1; next} found && /^## \[/{exit} found{print}" CHANGELOG.md > release_notes.md
if [ ! -s release_notes.md ]; then
echo "No changelog entry found for v${VERSION}." > release_notes.md
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
body_path: release_notes.md