Preview release (pkg.pr.new) #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Preview release (pkg.pr.new) | |
| # On-demand preview builds — NOT published to npm. | |
| # | |
| # Publishes @juspay/rescript-blend to pkg.pr.new and prints an installable URL | |
| # you can drop into a consumer (e.g. `yarn add https://pkg.pr.new/...`) to test a | |
| # branch's exact build before it is ever released. This is the producer side of | |
| # the `pkg.pr.new` URL that the sync-bindings workflow already accepts as input. | |
| # | |
| # Trigger from the Actions tab ("Run workflow" → pick a branch), or: | |
| # gh workflow run preview.yml --ref <branch> | |
| # | |
| # Prerequisite (one-time, org admin): install the pkg.pr.new GitHub App on this | |
| # repo — https://github.com/apps/pkg-pr-new. No npm token/secret is needed; | |
| # pkg.pr.new authenticates via the App plus this workflow's OIDC token. | |
| on: | |
| workflow_dispatch: | |
| concurrency: | |
| group: preview-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| id-token: write # required by pkg.pr.new for OIDC auth | |
| jobs: | |
| preview: | |
| name: Publish preview to pkg.pr.new | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "24" | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| # Gate the preview on a green build — never publish a preview that doesn't | |
| # compile. Bindings ship as source (.res), so no dist step is needed. | |
| - name: Build to confirm green | |
| run: npm run build | |
| # Publishes the package (respecting the `files` field) to pkg.pr.new and | |
| # writes the install URL to the run log + job summary. | |
| - name: Publish preview to pkg.pr.new | |
| run: npx pkg-pr-new publish |