From 79716476d602f1175a03e45f909111b6a4790f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E8=8F=9C=20Cai?= Date: Fri, 4 Oct 2024 01:17:16 +0800 Subject: [PATCH 1/4] feat(ci): add `pkg-pr` for branch `refactor/node` --- .github/workflows/pkg-pr.yml | 40 ++++++++++++++++++++++++++++++++++++ package.json | 1 + scripts/pkg-pr.mjs | 5 +++++ 3 files changed, 46 insertions(+) create mode 100644 .github/workflows/pkg-pr.yml create mode 100644 scripts/pkg-pr.mjs diff --git a/.github/workflows/pkg-pr.yml b/.github/workflows/pkg-pr.yml new file mode 100644 index 000000000..821e8d5ac --- /dev/null +++ b/.github/workflows/pkg-pr.yml @@ -0,0 +1,40 @@ +name: 'pkg-pr' +on: + push: + branches: + - 'refactor/node' + tags: + - '!**' + pull_request: + branches: + - 'refactor/node' + pull_request_review: + types: [submitted] + + +jobs: + continuous-release: + if: github.repository == 'farm-fe/farm' && github.event.review.state == 'APPROVED' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.node-version' + registry-url: 'https://registry.npmjs.org' + cache: 'pnpm' + + - name: Install deps + run: pnpm install + + - name: Build + run: pnpm build --withTypes + + - name: Release + run: pnpx pkg-pr-new publish --compact --pnpm './packages/cli' './packages/core' \ No newline at end of file diff --git a/package.json b/package.json index 66c35bed6..0eb8b134c 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "bump": "node scripts/bump.mjs", "bump:create-farm": "node scripts/bump-create-farm-version.mjs", "test:rs:update": "cross-env FARM_UPDATE_SNAPSHOTS=1 cargo test -p farmfe_compiler", + "pkg:pr": "node scripts/pkg-pr.mjs", "ready": "node scripts/ready.mjs", "test-e2e": "vitest run -c vitest.config.e2e.ts", "prepare": "husky", diff --git a/scripts/pkg-pr.mjs b/scripts/pkg-pr.mjs new file mode 100644 index 000000000..7d35b2bd6 --- /dev/null +++ b/scripts/pkg-pr.mjs @@ -0,0 +1,5 @@ +import { buildCli, buildCoreCjs, runTaskQueue } from './build.mjs'; + +await runTaskQueue(); +await buildCli(); +await buildCoreCjs(); From eb3be6d08a08c841a312ddb8ddb3b30ad0e8363d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E8=8F=9C=20Cai?= Date: Fri, 4 Oct 2024 12:03:08 +0800 Subject: [PATCH 2/4] =?UTF-8?q?chore:=20=E6=B7=BB=E5=8A=A0rust=E7=8E=AF?= =?UTF-8?q?=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pkg-pr.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pkg-pr.yml b/.github/workflows/pkg-pr.yml index 821e8d5ac..fe1ad81bd 100644 --- a/.github/workflows/pkg-pr.yml +++ b/.github/workflows/pkg-pr.yml @@ -20,6 +20,9 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Cache rust artifacts + uses: oxidecomputer/actions-rs_toolchain@oxide/master + - name: Install pnpm uses: pnpm/action-setup@v4 From ef49dca902a90ba84b901f62a22a9d711571ef18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E8=8F=9C=20Cai?= Date: Sun, 6 Oct 2024 03:15:07 +0800 Subject: [PATCH 3/4] chore: add pnpm version --- .github/workflows/pkg-pr.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pkg-pr.yml b/.github/workflows/pkg-pr.yml index fe1ad81bd..9b7678663 100644 --- a/.github/workflows/pkg-pr.yml +++ b/.github/workflows/pkg-pr.yml @@ -25,11 +25,13 @@ jobs: - name: Install pnpm uses: pnpm/action-setup@v4 + with: + version: 9 - name: Install Node.js uses: actions/setup-node@v4 with: - node-version-file: '.node-version' + node-version: '20' registry-url: 'https://registry.npmjs.org' cache: 'pnpm' From 84c895f82417f1ae0289727916f96acc43c284da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E8=8F=9C=20Cai?= Date: Sun, 6 Oct 2024 20:08:10 +0800 Subject: [PATCH 4/4] =?UTF-8?q?chore:=20=E4=BF=AE=E6=94=B9=E6=89=93?= =?UTF-8?q?=E5=8C=85=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pkg-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pkg-pr.yml b/.github/workflows/pkg-pr.yml index 9b7678663..a9ee67d57 100644 --- a/.github/workflows/pkg-pr.yml +++ b/.github/workflows/pkg-pr.yml @@ -39,7 +39,7 @@ jobs: run: pnpm install - name: Build - run: pnpm build --withTypes + run: pnpm run pkg:pr - name: Release run: pnpx pkg-pr-new publish --compact --pnpm './packages/cli' './packages/core' \ No newline at end of file