Skip to content

Commit 7d897b6

Browse files
committed
feat: add GitHub Actions workflow for publishing to JSR and npm
1 parent 7b40c28 commit 7d897b6

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed

.github/workflows/publish.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Publish to JSR and npm
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
id-token: write
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Setup Deno
20+
uses: denoland/setup-deno@v2
21+
with:
22+
deno-version: v2.x
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: "20"
28+
registry-url: "https://registry.npmjs.org"
29+
30+
- name: Run tests
31+
run: deno task test
32+
33+
- name: Type check
34+
run: deno task build
35+
36+
- name: Publish to JSR
37+
run: deno publish
38+
39+
- name: Run JSR to NPM conversion
40+
run: deno run -A https://raw.githubusercontent.com/yaonyan/jsr2npm/main/cli.ts
41+
42+
- name: Publish to npm
43+
run: |
44+
for dir in __*_*/dist; do
45+
cd "$dir"
46+
npm publish --access public --provenance
47+
cd ../..
48+
done
49+
env:
50+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
51+
52+
- name: Upload artifacts
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: npm-package
56+
path: __*_*/dist/
57+
retention-days: 7

jsr2npm.config.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"packages": [
3+
{
4+
"name": "@mcpc/utils",
5+
"version": "0.2.0",
6+
"packageJson": {
7+
"name": "@mcpc-tech/utils"
8+
}
9+
},
10+
{
11+
"name": "@mcpc/core",
12+
"version": "0.2.0",
13+
"packageJson": {
14+
"name": "@mcpc-tech/core"
15+
}
16+
},
17+
{
18+
"name": "@mcpc/cli",
19+
"version": "0.1.1",
20+
"packageJson": {
21+
"name": "@mcpc-tech/cli"
22+
}
23+
},
24+
{
25+
"name": "@mcpc/mcp-sampling-ai-provider",
26+
"version": "0.1.2",
27+
"packageJson": {
28+
"name": "@mcpc-tech/mcp-sampling-ai-provider"
29+
}
30+
}
31+
]
32+
}

0 commit comments

Comments
 (0)