File tree Expand file tree Collapse file tree 2 files changed +67
-1
lines changed Expand file tree Collapse file tree 2 files changed +67
-1
lines changed Original file line number Diff line number Diff line change 1+ name : Release
2+
3+ on :
4+ workflow_run :
5+ workflows : ["CI"]
6+ types :
7+ - completed
8+ branches :
9+ - master
10+ workflow_dispatch :
11+
12+ permissions :
13+ contents : write
14+ id-token : write
15+
16+ jobs :
17+ release :
18+ name : Release to npm
19+ runs-on : ubuntu-latest
20+ if : ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
21+
22+ steps :
23+ - name : Checkout code
24+ uses : actions/checkout@v4
25+ with :
26+ fetch-depth : 0
27+
28+ - name : Setup Node.js
29+ uses : actions/setup-node@v4
30+ with :
31+ node-version : ' 18'
32+ cache : ' yarn'
33+ registry-url : ' https://registry.npmjs.org'
34+
35+ - name : Install dependencies
36+ run : yarn install --frozen-lockfile
37+
38+ - name : Build packages
39+ run : yarn build
40+
41+ - name : Check for changes
42+ id : check-changes
43+ run : |
44+ # 检查是否有待发布的变更
45+ if yarn lerna changed --json | jq -e 'length > 0' > /dev/null; then
46+ echo "has-changes=true" >> $GITHUB_OUTPUT
47+ echo "Found packages with changes to publish"
48+ else
49+ echo "has-changes=false" >> $GITHUB_OUTPUT
50+ echo "No packages have changes to publish"
51+ fi
52+
53+ - name : Publish to npm
54+ if : steps.check-changes.outputs.has-changes == 'true'
55+ env :
56+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
57+ run : |
58+ yarn lerna publish from-package --yes
Original file line number Diff line number Diff line change 44 "version" : " independent" ,
55 "command" : {
66 "version" : {
7- "allowBranch" : " master"
7+ "allowBranch" : " master" ,
8+ "conventionalCommits" : true ,
9+ "message" : " chore(release): publish" ,
10+ "push" : true ,
11+ "createRelease" : false
12+ },
13+ "publish" : {
14+ "ignoreChanges" : [" **/*.md" , " **/test/**" , " **/*.test.*" ],
15+ "registry" : " https://registry.npmjs.org/"
816 }
917 },
1018 "ignoreChanges" : [" **/*.md" , " **/test/**" ]
You can’t perform that action at this time.
0 commit comments