Skip to content

Commit 432a355

Browse files
ci: publish package previews
1 parent 0b77744 commit 432a355

5 files changed

Lines changed: 63 additions & 0 deletions

File tree

.github/workflows/pkg-pr-new.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Publish Package Previews
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
permissions: {}
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
18+
with:
19+
node-version: 24.19.0
20+
package-manager-cache: false
21+
22+
- name: Install Pnpm
23+
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
24+
with:
25+
run_install: true
26+
27+
- name: Build Packages
28+
run: node --run build
29+
30+
- name: Publish Package Previews
31+
run: pnpm exec pkg-pr-new publish --pnpm --previewVersion --no-template './packages/rstack' './packages/create-rstack'

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"cspell-ban-words": "catalog:",
2323
"globals": "catalog:",
2424
"heading-case": "catalog:",
25+
"pkg-pr-new": "catalog:",
2526
"prettier": "catalog:",
2627
"rstack": "workspace:*",
2728
"typescript": "catalog:"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { readFile } from 'node:fs/promises';
2+
import { expect, test } from 'rstack/test';
3+
4+
test('publishes pull request previews for public packages', async () => {
5+
const [workflow, packageJson, workspace] = await Promise.all([
6+
readFile(
7+
new URL('../../../.github/workflows/pkg-pr-new.yml', import.meta.url),
8+
'utf8',
9+
),
10+
readFile(new URL('../../../package.json', import.meta.url), 'utf8'),
11+
readFile(new URL('../../../pnpm-workspace.yaml', import.meta.url), 'utf8'),
12+
]);
13+
14+
expect(workflow).toContain('pkg-pr-new publish --pnpm --previewVersion');
15+
expect(workflow).toContain("'./packages/rstack'");
16+
expect(workflow).toContain("'./packages/create-rstack'");
17+
expect(workflow).not.toContain('head.repo.full_name == github.repository');
18+
expect(packageJson).toContain('"pkg-pr-new": "catalog:"');
19+
expect(workspace).toContain('pkg-pr-new: 0.0.87');
20+
});

pnpm-lock.yaml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ catalog:
4545
is-binary-path: 3.0.0
4646
'lint-staged': '^17.3.0'
4747
'micromatch': '4.0.8'
48+
pkg-pr-new: 0.0.87
4849
prettier: '3.9.6'
4950
'prettier-plugin-svelte': '^4.1.1'
5051
'react': '^19.2.8'

0 commit comments

Comments
 (0)