From cfe1552ec91405e40c9284764e466768ee910fce Mon Sep 17 00:00:00 2001 From: claude-code-best Date: Thu, 23 Apr 2026 22:42:33 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E7=BB=9F=E4=B8=80=20typecheck=20?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E5=B9=B6=E6=B7=BB=E5=8A=A0=20npm=20=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 +- .github/workflows/publish-npm.yml | 53 +++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish-npm.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aaff14ef6..226817a8f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: run: bun install --frozen-lockfile - name: Type check - run: bunx tsc --noEmit + run: bun run typecheck - name: Test with Coverage run: | diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml new file mode 100644 index 000000000..3d84b0c28 --- /dev/null +++ b/.github/workflows/publish-npm.yml @@ -0,0 +1,53 @@ +name: Publish to npm + +on: + push: + tags: + - 'v*' + +permissions: + contents: read + packages: write + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: '20.x' + registry-url: 'https://registry.npmjs.org' + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - name: Install dependencies + run: bun install --frozen-lockfile + + - name: Build + run: bun run build:vite + + - name: Type check + run: bun run typecheck + + - name: Run tests + run: bun test + + - name: Publish to npm + run: | + VERSION="${GITHUB_REF_NAME#v}" + TAG="latest" + if [[ "$VERSION" == *"beta"* ]]; then + TAG="beta" + elif [[ "$VERSION" == *"alpha"* ]]; then + TAG="alpha" + elif [[ "$VERSION" == *"rc"* ]]; then + TAG="rc" + fi + npm publish --tag "$TAG" --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}