Skip to content

Commit 55f3ff0

Browse files
committed
Add npm ci
1 parent cac81e9 commit 55f3ff0

2 files changed

Lines changed: 38 additions & 1 deletion

File tree

.github/workflows/npm.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish to npm
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
id-token: write
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: oven-sh/setup-bun@v2
18+
with:
19+
bun-version: latest
20+
21+
- name: Install dependencies
22+
run: bun install
23+
24+
- name: Generate types package
25+
run: bun run generate-types
26+
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: '20'
31+
registry-url: 'https://registry.npmjs.org'
32+
33+
- name: Publish to npm
34+
run: cd dist && npm publish --provenance
35+
env:
36+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

scripts/generate-types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { version } from "../package.json";
12
import { zodToTs } from "zod-to-ts";
23
import ts from "typescript";
34
import prettier from "prettier";
@@ -227,7 +228,7 @@ export type Dictionary<T> = Record<string, T>;
227228
// Generate package.json for npm publish
228229
const packageJson = {
229230
name: "@openworkers/api-types",
230-
version: "1.0.0",
231+
version,
231232
license: "MIT",
232233
type: "module",
233234
private: false,

0 commit comments

Comments
 (0)