From dc5cc2d3e0f9707e03619ad56d9510b1d00aa683 Mon Sep 17 00:00:00 2001 From: Philippe Serhal Date: Wed, 5 Aug 2026 07:22:58 -0400 Subject: [PATCH 1/2] ci: configure pre-release workflow via pkg.pr.new In preparation for enabling/requiring Trusted Publishing and revoking folks' ability to publish manually, this configures pkg.pr.new to craete pre-releases automatically on all PRs. --- .github/workflows/pre-release.yml | 54 ++++++++----------------------- CONTRIBUTING.md | 7 ++-- package-lock.json | 11 +++++++ package.json | 1 + 4 files changed, 28 insertions(+), 45 deletions(-) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 7a5036baf49..2228b5e5775 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -2,27 +2,29 @@ name: prerelease on: push: - branches: - # releases// - - releases/*/* + branches: [main] + pull_request: + types: [opened, synchronize, reopened] + +permissions: + contents: read + jobs: prerelease: - runs-on: ubuntu-latest - permissions: - id-token: write - contents: write + runs-on: ubuntu-slim steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + persist-credentials: false - name: Read primary Node version id: node run: echo "version=$(yq eval '.primary_node_version' .github/test-matrix.yml)" >> "$GITHUB_OUTPUT" - - uses: actions/setup-node@v6 + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version: ${{ steps.node.outputs.version }} cache: npm - registry-url: 'https://registry.npmjs.org' # Use npm@10 due to https://github.com/npm/cli/issues/8489 and https://github.com/npm/cli/issues/8767 - name: Setup npm version @@ -34,33 +36,5 @@ jobs: - name: Build project run: npm run build - - name: Extract tag and version - id: extract - run: |- - ref=${{ github.ref }} - branch=${ref:11} - tag_version=${branch:9} - tag=${tag_version%/*} - version=${tag_version##*/} - echo "tag=${tag}" >> $GITHUB_OUTPUT - echo "version=${version}" >> $GITHUB_OUTPUT - - name: Log versions - run: |- - echo tag=${{ steps.extract.outputs.tag }} - echo version=${{ steps.extract.outputs.version }} - - - name: Configure Git user - run: | - git config --global user.name "Netlify" - git config --global user.email "82042599+token-generator-app[bot]@users.noreply.github.com" - - - name: Run npm version - run: npm version ${{ steps.extract.outputs.version }}-${{ steps.extract.outputs.tag }} --allow-same-version - - - name: Push changes - run: git push --follow-tags - - - name: Run npm publish - run: npm publish --tag=${{ steps.extract.outputs.tag }} --provenance - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + - name: Publish prerelease + run: npm exec -- pkg-pr-new publish diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b23b6fde72a..11ee66d711a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -205,11 +205,8 @@ package to npm. ### Creating a prerelease -1. Create a branch named `releases//` with the version and tag you’d like to release. -2. Push the branch to the repo. - -For example, a branch named `releases/rc.0/4.0.0` will create the version `4.0.0-rc.0` and publish it under the `rc.0` -tag. +Pull requests and pushes to `main` automatically publish installable prereleases with [pkg.pr.new](https://pkg.pr.new/). +Check the prerelease workflow run for the package version and installation command. ## License diff --git a/package-lock.json b/package-lock.json index 6f4cc34b6ea..07e07481386 100644 --- a/package-lock.json +++ b/package-lock.json @@ -164,6 +164,7 @@ "npm-run-all2": "^8.0.4", "p-timeout": "^7.0.0", "picomatch": "^4.0.4", + "pkg-pr-new": "^0.0.86", "prettier": "^2.8.8", "serialize-javascript": "^7.0.5", "strip-ansi": "^7.1.2", @@ -18659,6 +18660,16 @@ "node": ">= 10.x" } }, + "node_modules/pkg-pr-new": { + "version": "0.0.86", + "resolved": "https://registry.npmjs.org/pkg-pr-new/-/pkg-pr-new-0.0.86.tgz", + "integrity": "sha512-BwPsw/e1Be7F0SfpxhNc2VSxX7uHgCy46Ck+2Z/vqCwXoePhUBrX/VbcawpAlZgMvQe2iwGbZIQ6HSj9bmCk8A==", + "dev": true, + "license": "MIT", + "bin": { + "pkg-pr-new": "bin/cli.js" + } + }, "node_modules/pkg-types": { "version": "1.3.1", "license": "MIT", diff --git a/package.json b/package.json index 1a209442bd2..54408840ba0 100644 --- a/package.json +++ b/package.json @@ -205,6 +205,7 @@ "npm-run-all2": "^8.0.4", "p-timeout": "^7.0.0", "picomatch": "^4.0.4", + "pkg-pr-new": "^0.0.86", "prettier": "^2.8.8", "serialize-javascript": "^7.0.5", "strip-ansi": "^7.1.2", From 1df94d5d3846750bd9c693fa718504ce2a5fab9e Mon Sep 17 00:00:00 2001 From: Philippe Serhal Date: Fri, 7 Aug 2026 14:18:55 -0400 Subject: [PATCH 2/2] ci: use pkg-pr-new publish --previewVersion --- .github/workflows/pre-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 2228b5e5775..dfe87f3737d 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -37,4 +37,4 @@ jobs: run: npm run build - name: Publish prerelease - run: npm exec -- pkg-pr-new publish + run: npm exec -- pkg-pr-new publish --previewVersion