Skip to content

Commit 94501df

Browse files
committed
configure pkg.pr.new
1 parent 10a218c commit 94501df

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

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

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish to pkg.pr.new
2+
on: [push, pull_request]
3+
4+
jobs:
5+
build:
6+
runs-on: ubuntu-latest
7+
8+
steps:
9+
- uses: actions/checkout@v4
10+
- uses: pnpm/action-setup@v2
11+
- uses: actions/setup-node@v4
12+
- name: Install Packages
13+
run: pnpm install
14+
- name: Build
15+
run: pnpm run build
16+
17+
- run: pnpx pkg-pr-new publish --comment=off --json output.json --compact --no-template
18+
- name: Add metadata to output
19+
uses: actions/github-script@v6
20+
with:
21+
github-token: ${{ secrets.GITHUB_TOKEN }}
22+
script: |
23+
const fs = require('fs');
24+
const output = JSON.parse(fs.readFileSync('output.json', 'utf8'));
25+
output.number = context.issue.number;
26+
output.event_name = context.eventName;
27+
output.ref = context.ref;
28+
fs.writeFileSync('output.json', JSON.stringify(output), 'utf8');
29+
- name: Upload output
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: output
33+
path: ./output.json
34+
35+
- run: ls -R .

0 commit comments

Comments
 (0)