From 9106b78d003d9fcc8fea9ccc7e2861ea44ee0c69 Mon Sep 17 00:00:00 2001 From: Shibo Lyu Date: Thu, 22 May 2025 20:48:42 +0800 Subject: [PATCH] ci: Split workflows into test and conditional publishing --- .github/workflows/publish.yml | 7 ++++--- .github/workflows/test.yml | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a177b6a..fb1ee58 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..eff7be5 --- /dev/null +++ b/.github/workflows/test.yml @@ -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