From 2fbe2bcfbbf262a55311223c0d8565379b032cdb Mon Sep 17 00:00:00 2001 From: underfin Date: Mon, 19 May 2025 17:25:12 +0800 Subject: [PATCH 1/3] ci: add preview release action --- .github/workflows/release-continuous.yml | 29 ++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/release-continuous.yml diff --git a/.github/workflows/release-continuous.yml b/.github/workflows/release-continuous.yml new file mode 100644 index 00000000..fb59d4c0 --- /dev/null +++ b/.github/workflows/release-continuous.yml @@ -0,0 +1,29 @@ +name: Publish Any Commit +on: [push, pull_request] + +permissions: {} + +jobs: + preview: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 + + - uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: pnpm + + - name: Install dependencies + run: pnpm install + + - name: Build + run: pnpm build + + - name: Publish + run: pnpm dlx pkg-pr-new@0.0 publish --pnpm --compact './packages/*' From 2b94c4684bf2ac6e0dde6a9cfe8f1d20ecbc3bad Mon Sep 17 00:00:00 2001 From: underfin Date: Mon, 19 May 2025 18:20:15 +0800 Subject: [PATCH 2/3] chore: fix swc --- .github/workflows/release-continuous.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-continuous.yml b/.github/workflows/release-continuous.yml index fb59d4c0..3db3b0e2 100644 --- a/.github/workflows/release-continuous.yml +++ b/.github/workflows/release-continuous.yml @@ -26,4 +26,4 @@ jobs: run: pnpm build - name: Publish - run: pnpm dlx pkg-pr-new@0.0 publish --pnpm --compact './packages/*' + run: pnpm dlx pkg-pr-new@0.0 publish --pnpm --compact './packages/*' './packages/plugin-react-swc/dist' From 536baed45d94592906ec5843291a6f10a3c7ec0f Mon Sep 17 00:00:00 2001 From: underfin Date: Tue, 20 May 2025 09:44:27 +0800 Subject: [PATCH 3/3] chore: add condition --- .github/workflows/release-continuous.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-continuous.yml b/.github/workflows/release-continuous.yml index 3db3b0e2..9534f0cc 100644 --- a/.github/workflows/release-continuous.yml +++ b/.github/workflows/release-continuous.yml @@ -1,12 +1,21 @@ -name: Publish Any Commit -on: [push, pull_request] +name: Preview Publish + +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, labeled] permissions: {} jobs: preview: + if: > + github.repository == 'vitejs/vite-plugin-react' && + (github.event_name == 'push' || + (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'trigger: preview'))) runs-on: ubuntu-latest - steps: - name: Checkout code uses: actions/checkout@v4