File tree Expand file tree Collapse file tree 4 files changed +319
-1
lines changed Expand file tree Collapse file tree 4 files changed +319
-1
lines changed Original file line number Diff line number Diff line change
1
+ name : Release to @pr-<number> tag on npm
2
+ on :
3
+ pull_request :
4
+ workflow_dispatch :
5
+
6
+ jobs :
7
+ release-pr :
8
+ name : ' Release PR to npm'
9
+ runs-on : buildjet-4vcpu-ubuntu-2204
10
+ # comment out if:false to enable release PR to npm
11
+ # if: false
12
+ permissions : write-all
13
+ steps :
14
+ - uses : actions/checkout@v3
15
+ with :
16
+ # need this to get full git-history/clone in order to build changelogs and check changesets
17
+ fetch-depth : 0
18
+ ref : ${{ github.event.pull_request.head.ref }}
19
+
20
+ - uses : FuelLabs/github-actions/setups/node@master
21
+ with :
22
+ node-version : 20.11.0
23
+ pnpm-version : 8.15.7
24
+ - uses : FuelLabs/github-actions/setups/npm@master
25
+ with :
26
+ npm-token : ${{ secrets.NPM_TOKEN }}
27
+
28
+ - name : Build
29
+ run : pnpm build
30
+
31
+ - name : Release to @pr-${{ github.event.pull_request.number }} tag on npm
32
+ id : release
33
+ run : |
34
+ pnpm changeset:next
35
+ git add .changeset/fuel-labs-ci.md
36
+ pnpm changeset version --snapshot pr-${{ env.PR_NUMBER }}
37
+ changetsets=$(pnpm changeset publish --tag pr-${{ env.PR_NUMBER }})
38
+ published_version=$(echo "$changetsets" | grep -oP '@\K([0-9]+\.){2}[0-9]+-pr-${{ env.PR_NUMBER }}-\d+' | head -1)
39
+ echo "published_version=$published_version" >> $GITHUB_OUTPUT
40
+ env :
41
+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
42
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
43
+ PR_NUMBER : ${{ github.event.pull_request.number }}
44
+
45
+ - uses : mshick/add-pr-comment@v2
46
+ with :
47
+ message : |
48
+ This PR is published in NPM with version **${{ steps.release.outputs.published_version }}**
49
+ env :
50
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 15
15
"lint:ci" : " biome lint --max-diagnostics=1000 --diagnostic-level=error ." ,
16
16
"format" : " biome format --write ." ,
17
17
"changeset" : " changeset" ,
18
+ "changeset:next" : " tsx ./scripts/changeset-next" ,
18
19
"packages:version" : " node ./scripts/version.js" ,
19
20
"prepare" : " husky"
20
21
},
28
29
"compare-versions" : " 6.1.0" ,
29
30
"husky" : " 9.0.11" ,
30
31
"lint-staged" : " 15.2.2" ,
32
+ "tsx" : " ^4.16.2" ,
31
33
"turbo" : " 1.13.3" ,
32
34
"vitest" : " 1.6.0"
33
35
},
34
- "packageManager" : " pnpm@8.9.0" ,
35
36
"engines" : {
36
37
"node" : " >=18" ,
37
38
"pnpm" : " >=8"
You can’t perform that action at this time.
0 commit comments