Skip to content

Commit 9bbe4b3

Browse files
authored
ci: split CI/CD workflows (#33)
1 parent 8ef96fe commit 9bbe4b3

File tree

2 files changed

+59
-48
lines changed

2 files changed

+59
-48
lines changed
Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: CI/CD
33
on:
44
push:
55
branches: [main]
6-
tags: ["v*"]
76
pull_request:
87
branches: [main]
98
workflow_dispatch:
@@ -112,50 +111,3 @@ jobs:
112111
bun build "$file" --target=node --outdir=/tmp/build-test > /dev/null && echo "✓ $file builds successfully"
113112
fi
114113
done
115-
116-
publish:
117-
name: Publish to NPM
118-
runs-on: ubuntu-latest
119-
needs: [test, build, validate-examples]
120-
if: startsWith(github.ref, 'refs/tags/v')
121-
environment: npm
122-
permissions:
123-
contents: write
124-
id-token: write
125-
126-
steps:
127-
- uses: actions/checkout@v6
128-
- uses: actions/setup-node@v6
129-
with:
130-
node-version: "20"
131-
registry-url: "https://registry.npmjs.org"
132-
- uses: oven-sh/setup-bun@v2
133-
with:
134-
bun-version: latest
135-
- run: bun install --frozen-lockfile
136-
- run: |
137-
bun run build:templates
138-
bun run build
139-
140-
- name: Verify version match
141-
run: |
142-
PACKAGE_VERSION="v$(node -p "require('./package.json').version")"
143-
TAG_VERSION="${GITHUB_REF#refs/tags/}"
144-
if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
145-
echo "Error: Package version ($PACKAGE_VERSION) doesn't match tag ($TAG_VERSION)"
146-
exit 1
147-
fi
148-
echo "✅ Version verified: $PACKAGE_VERSION"
149-
150-
- run: npm publish --provenance --access public
151-
env:
152-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
153-
154-
- uses: softprops/action-gh-release@v2
155-
with:
156-
name: Release ${{ github.ref_name }}
157-
generate_release_notes: true
158-
draft: false
159-
prerelease: ${{ contains(github.ref_name, '-') }}
160-
files: |
161-
dist/**/*

.github/workflows/release.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
tag:
9+
description: "Tag to publish (e.g. v1.2.3)"
10+
required: true
11+
type: string
12+
13+
jobs:
14+
publish:
15+
runs-on: ubuntu-latest
16+
environment: npm
17+
permissions:
18+
contents: read
19+
id-token: write
20+
21+
steps:
22+
- uses: actions/checkout@v6
23+
with:
24+
ref: ${{ github.event.inputs.tag || github.ref_name }}
25+
- uses: oven-sh/setup-bun@v2
26+
with:
27+
bun-version: latest
28+
- uses: actions/setup-node@v6
29+
with:
30+
node-version: "24"
31+
registry-url: "https://registry.npmjs.org"
32+
33+
- run: bun install --frozen-lockfile
34+
- run: bun run build:templates
35+
- run: bun run build
36+
37+
- name: Verify version match
38+
run: |
39+
TAG_REF="${{ github.event.inputs.tag || github.ref_name }}"
40+
PACKAGE_VERSION="v$(node -p \"require('./package.json').version\")"
41+
if [ "$PACKAGE_VERSION" != "$TAG_REF" ]; then
42+
echo "Error: Package version ($PACKAGE_VERSION) doesn't match tag ($TAG_REF)"
43+
exit 1
44+
fi
45+
echo "✅ Version verified: $PACKAGE_VERSION"
46+
47+
- name: Verify dist output
48+
run: |
49+
if [ ! -f "dist/index.js" ]; then
50+
echo "Error: dist/index.js not found"
51+
exit 1
52+
fi
53+
if [ ! -f "dist/index.d.ts" ]; then
54+
echo "Error: dist/index.d.ts not found"
55+
exit 1
56+
fi
57+
echo "✅ Build output verified"
58+
59+
- run: npm publish --access public --provenance

0 commit comments

Comments
 (0)