File tree Expand file tree Collapse file tree 1 file changed +62
-0
lines changed
Expand file tree Collapse file tree 1 file changed +62
-0
lines changed Original file line number Diff line number Diff line change 1+ name : release
2+
3+ permissions :
4+ contents : write
5+
6+ on :
7+ issue_comment :
8+ types :
9+ - created
10+
11+ jobs :
12+ release :
13+ if : ${{ github.event.issue.pull_request && github.event.comment.body == 'npm publish' }}
14+ runs-on : ubuntu-latest
15+ steps :
16+ - uses : actions/checkout@v4
17+ with :
18+ fetch-depth : 0
19+
20+ - name : Install pnpm
21+ uses : pnpm/action-setup@v3
22+ with :
23+ version : 9
24+
25+ - name : Install Node.js
26+ uses : actions/setup-node@v4
27+ with :
28+ node-version : 20
29+ cache : " pnpm"
30+ registry-url : " https://registry.npmjs.org"
31+
32+ - name : npm version
33+ run : npm version --no-git-tag-version 0.0.0-$(git rev-parse HEAD)
34+ env :
35+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
36+
37+ - name : Install dependencies
38+ run : pnpm install
39+
40+ # publish to npm tag as next
41+ - run : pnpm publish --no-git-checks --tag pre
42+ env :
43+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
44+
45+ - name : " Update comment"
46+ uses : actions/github-script@v7
47+ with :
48+ github-token : ${{ secrets.GITHUB_TOKEN }}
49+ script : |
50+ const { issue: { number: issue_number }, repo: { owner, repo }, payload } = context;
51+ const { name: packageName, version } = require(`${process.env.GITHUB_WORKSPACE}/package.json`);
52+
53+ await github.rest.issues.updateComment({
54+ owner,
55+ repo,
56+ comment_id: payload.comment.id,
57+ body: [
58+ `npm package published to pre tag.`,
59+ `\`\`\`bash\nnpm install ${packageName}@pre\n\`\`\``
60+ `\`\`\`bash\nnpm install ${packageName}@${version}\n\`\`\``
61+ ].join('\n\n'),
62+ });
You can’t perform that action at this time.
0 commit comments