diff --git a/.github/workflows/pkg-pr-new.yml b/.github/workflows/pkg-pr-new.yml index 0239253c..74904b7d 100644 --- a/.github/workflows/pkg-pr-new.yml +++ b/.github/workflows/pkg-pr-new.yml @@ -1,31 +1,54 @@ name: Publish Package Previews on: - pull_request: - branches: [main] + workflow_dispatch: -permissions: {} +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read jobs: + native: + name: Build native packages + 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 + './packages/rstack' './packages/create-rstack' './packages/rstack/npm/*' 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'); -});