Skip to content

Commit 031d661

Browse files
committed
configure pkg.pr.new
1 parent 10a218c commit 031d661

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
- name: Checkout code
10+
uses: actions/checkout@v4
11+
12+
- run: corepack enable
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: 18.x
16+
cache: pnpm
17+
18+
- name: Install dependencies
19+
run: pnpm install --frozen-lockfile
20+
21+
- name: Build
22+
run: pnpm build
23+
24+
- run: pnpx pkg-pr-new publish --comment=off --json output.json --compact --no-template
25+
- name: Add metadata to output
26+
uses: actions/github-script@v6
27+
with:
28+
github-token: ${{ secrets.GITHUB_TOKEN }}
29+
script: |
30+
const fs = require('fs');
31+
const output = JSON.parse(fs.readFileSync('output.json', 'utf8'));
32+
output.number = context.issue.number;
33+
output.event_name = context.eventName;
34+
output.ref = context.ref;
35+
fs.writeFileSync('output.json', JSON.stringify(output), 'utf8');
36+
- name: Upload output
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: output
40+
path: ./output.json
41+
42+
- run: ls -R .

0 commit comments

Comments
 (0)