From 66705f4ee542f779fba9611fa4c9cc4e28d4add7 Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 10 Nov 2026 16:23:40 +0800 Subject: [PATCH 1/3] fix(ci): include native bindings and docs in package previews --- .github/workflows/pkg-pr-new.yml | 56 +++++++++++++++++++++++--- packages/rstack/tests/pkgPrNew.test.ts | 20 --------- 2 files changed, 51 insertions(+), 25 deletions(-) delete mode 100644 packages/rstack/tests/pkgPrNew.test.ts diff --git a/.github/workflows/pkg-pr-new.yml b/.github/workflows/pkg-pr-new.yml index 0239253c..0612ed7e 100644 --- a/.github/workflows/pkg-pr-new.yml +++ b/.github/workflows/pkg-pr-new.yml @@ -3,29 +3,75 @@ name: Publish Package Previews on: pull_request: branches: [main] + types: [opened, synchronize, reopened, ready_for_review] -permissions: {} +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +permissions: + contents: read jobs: + native: + name: Build native packages + if: github.event.pull_request.draft == false + uses: ./.github/workflows/reusable-native-release.yml + publish: + needs: native runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - name: Setup Node.js - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7 + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7 with: - node-version: 24.19.0 + node-version: 24.22.2 package-manager-cache: false - name: Install Pnpm - uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10 + uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 with: run_install: true - name: Build Packages run: node --run build + - name: Prepare release + run: node --run release:prepare + + - name: Download native packages + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: native-packages + path: packages/rstack/npm + + - name: Prepare native packages + run: pnpm --dir packages/rstack exec napi pre-publish --config-path napi.json --skip-optional-publish --no-gh-release + - name: Publish Package Previews - run: pnpm exec pkg-pr-new publish --pnpm --previewVersion --no-template './packages/rstack' './packages/create-rstack' + run: | + pnpm exec pkg-pr-new publish --pnpm --previewVersion --no-template \ + --json "$RUNNER_TEMP/preview-packages.json" \ + './packages/rstack' './packages/create-rstack' './packages/rstack/npm/*' + + - name: Smoke test published previews + run: | + metadata="$RUNNER_TEMP/preview-packages.json" + rstack_url=$(jq -er '.packages[] | select(.name == "rstack").url' "$metadata") + create_rstack_url=$(jq -er '.packages[] | select(.name == "create-rstack").url' "$metadata") + + cd "$(mktemp -d)" + # The optional native packages are also installed from preview URLs. + npm install --allow-remote=all --no-audit --no-fund "$rstack_url" "$create_rstack_url" + + printf 'ignored.js\n' > .gitignore + printf 'const ignored=1\n' > ignored.js + printf 'const formatted = 1;\n' > formatted.js + ./node_modules/.bin/rs fmt --check --ignore-path .gitignore formatted.js ignored.js + test -s node_modules/rstack/docs/llms.txt + + ./node_modules/.bin/create-rstack --dir smoke-app --template app-vanilla --no-git + test -s smoke-app/package.json diff --git a/packages/rstack/tests/pkgPrNew.test.ts b/packages/rstack/tests/pkgPrNew.test.ts deleted file mode 100644 index aebbee97..00000000 --- a/packages/rstack/tests/pkgPrNew.test.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { readFile } from 'node:fs/promises'; -import { expect, test } from 'rstack/test'; - -test('publishes pull request previews for public packages', async () => { - const [workflow, packageJson, workspace] = await Promise.all([ - readFile( - new URL('../../../.github/workflows/pkg-pr-new.yml', import.meta.url), - 'utf8', - ), - readFile(new URL('../../../package.json', import.meta.url), 'utf8'), - readFile(new URL('../../../pnpm-workspace.yaml', import.meta.url), 'utf8'), - ]); - - expect(workflow).toContain('pkg-pr-new publish --pnpm --previewVersion'); - expect(workflow).toContain("'./packages/rstack'"); - expect(workflow).toContain("'./packages/create-rstack'"); - expect(workflow).not.toContain('head.repo.full_name == github.repository'); - expect(packageJson).toContain('"pkg-pr-new": "catalog:"'); - expect(workspace).toContain('pkg-pr-new: 0.0.87'); -}); From 58cc29ba689c40a4ec0c5df600a7482fa721c776 Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 10 Nov 2026 16:35:23 +0800 Subject: [PATCH 2/3] chore(ci): simplify package preview publishing --- .github/workflows/pkg-pr-new.yml | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/.github/workflows/pkg-pr-new.yml b/.github/workflows/pkg-pr-new.yml index 0612ed7e..e9774771 100644 --- a/.github/workflows/pkg-pr-new.yml +++ b/.github/workflows/pkg-pr-new.yml @@ -52,26 +52,6 @@ jobs: run: pnpm --dir packages/rstack exec napi pre-publish --config-path napi.json --skip-optional-publish --no-gh-release - name: Publish Package Previews - run: | - pnpm exec pkg-pr-new publish --pnpm --previewVersion --no-template \ - --json "$RUNNER_TEMP/preview-packages.json" \ - './packages/rstack' './packages/create-rstack' './packages/rstack/npm/*' - - - name: Smoke test published previews - run: | - metadata="$RUNNER_TEMP/preview-packages.json" - rstack_url=$(jq -er '.packages[] | select(.name == "rstack").url' "$metadata") - create_rstack_url=$(jq -er '.packages[] | select(.name == "create-rstack").url' "$metadata") - - cd "$(mktemp -d)" - # The optional native packages are also installed from preview URLs. - npm install --allow-remote=all --no-audit --no-fund "$rstack_url" "$create_rstack_url" - - printf 'ignored.js\n' > .gitignore - printf 'const ignored=1\n' > ignored.js - printf 'const formatted = 1;\n' > formatted.js - ./node_modules/.bin/rs fmt --check --ignore-path .gitignore formatted.js ignored.js - test -s node_modules/rstack/docs/llms.txt - - ./node_modules/.bin/create-rstack --dir smoke-app --template app-vanilla --no-git - test -s smoke-app/package.json + run: >- + pnpm exec pkg-pr-new publish --pnpm --previewVersion --no-template + './packages/rstack' './packages/create-rstack' './packages/rstack/npm/*' From 6bb776f0d519826f0dc5a811b73bb8e18ab63e3c Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 10 Nov 2026 17:20:48 +0800 Subject: [PATCH 3/3] fix(ci): publish package previews only on manual dispatch --- .github/workflows/pkg-pr-new.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pkg-pr-new.yml b/.github/workflows/pkg-pr-new.yml index e9774771..74904b7d 100644 --- a/.github/workflows/pkg-pr-new.yml +++ b/.github/workflows/pkg-pr-new.yml @@ -1,12 +1,10 @@ name: Publish Package Previews on: - pull_request: - branches: [main] - types: [opened, synchronize, reopened, ready_for_review] + workflow_dispatch: concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true permissions: @@ -15,7 +13,6 @@ permissions: jobs: native: name: Build native packages - if: github.event.pull_request.draft == false uses: ./.github/workflows/reusable-native-release.yml publish: