Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/pkg-pr-new.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish Package Previews

on:
pull_request:
branches: [main]

permissions: {}

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7

- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
node-version: 24.19.0
package-manager-cache: false

- name: Install Pnpm
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
with:
run_install: true

- name: Build Packages
run: node --run build

- name: Publish Package Previews
run: pnpm exec pkg-pr-new publish --pnpm --previewVersion --no-template './packages/rstack' './packages/create-rstack'
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"cspell-ban-words": "catalog:",
"globals": "catalog:",
"heading-case": "catalog:",
"pkg-pr-new": "catalog:",
"prettier": "catalog:",
"rstack": "workspace:*",
"typescript": "catalog:"
Expand Down
20 changes: 20 additions & 0 deletions packages/rstack/tests/pkgPrNew.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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');
});
10 changes: 10 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ catalog:
is-binary-path: 3.0.0
'lint-staged': '^17.3.0'
'micromatch': '4.0.8'
pkg-pr-new: 0.0.87
prettier: '3.9.6'
'prettier-plugin-svelte': '^4.1.1'
'react': '^19.2.8'
Expand Down
Loading