ci: Split workflows into test and conditional publishing

This commit is contained in:
Shibo Lyu 2025-05-22 20:48:42 +08:00
parent 45d74bc024
commit 9106b78d00
2 changed files with 30 additions and 3 deletions

View file

@ -1,9 +1,10 @@
name: Test & Publish on JSR & npm
on:
push:
branches:
- main
workflow_run:
workflows: ["Test"]
types:
- completed
jobs:
testAndPublish:
runs-on: ubuntu-latest

26
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,26 @@
name: Test
on:
push:
pull_request:
jobs:
testAndPublish:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22.x"
registry-url: "https://registry.npmjs.org"
- uses: pnpm/action-setup@v4
- name: Install dependencies
run: pnpm install
- name: Build & Test
run: pnpm build && pnpm test