Skip to content

Commit 59d9941

Browse files
committed
chore: add publish workflow for npm
1 parent 62be1eb commit 59d9941

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.github/workflows/publish_npm.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Publish to npm
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
build-and-publish:
10+
runs-on: ubuntu-latest
11+
12+
permissions:
13+
contents: read
14+
id-token: write
15+
16+
steps:
17+
# Checkout the repository
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
# Set up Deno
22+
- name: Set up Deno
23+
uses: denoland/setup-deno@v2
24+
with:
25+
deno-version: v1.x
26+
27+
# Install npm
28+
- name: Set up Node.js
29+
uses: actions/setup-node@v3
30+
with:
31+
node-version: 20
32+
33+
# Build the npm package
34+
- name: Build npm package
35+
run: deno run --allow-read --allow-write --allow-net --allow-env --allow-run npm_build.ts ${{ github.event.release.tag_name }}
36+
37+
# Publish to npm
38+
- name: Publish to npm
39+
run: |
40+
cd npm
41+
npm publish
42+
env:
43+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)