@@ -73,52 +73,65 @@ jobs:
7373 path : |
7474 packages/*/dist/**
7575 packages/*/es/**
76+ packages/*/package.json
7677 package.json
7778 retention-days : 7
7879 release_npm :
7980 permissions :
80- contents : write
8181 id-token : write
8282
8383 needs : [build]
8484 environment : release
8585 runs-on : ubuntu-latest
8686
8787 steps :
88- - name : Checkout code
88+ - name : Checkout tag
8989 uses : actions/checkout@v4
9090 with :
9191 ref : ${{ github.ref }}
92- fetch-depth : 1
93-
94- - name : Setup Git
95- run : |
96- git config --global user.name "${{ github.actor }}"
97- git config --global user.email "${{ github.actor }}@users.noreply.github.com"
98- git fetch --tags
9992
10093 - name : Setup Node.js
10194 uses : actions/setup-node@v4
10295 with :
10396 node-version : 22.x
10497 registry-url : ' https://registry.npmjs.org'
98+ token : ${{ secrets.NPM_TOKEN }}
10599
106- - name : Cache node_modules
107- uses : actions/cache @v4
100+ - name : Download build artifacts
101+ uses : actions/download-artifact @v4
108102 with :
109- path : node_modules
110- key : ${{ runner.os }}-release-${{ hashFiles('**/package.json', '**/yarn.lock') }}
111- restore-keys : |
112- ${{ runner.os }}-release-
113- ${{ runner.os }}-build-
114- ${{ runner.os }}-
103+ name : build
104+
105+ - name : Publish to npm
106+ run : |
107+ zx scripts/workflow/npm-publish.mjs
108+ env :
109+ NPM_CONFIG_PROVENANCE : true
110+
111+ create_release_pr :
112+ permissions :
113+ contents : write
114+ pull-requests : write
115+
116+ needs : [build, release_npm]
117+ runs-on : ubuntu-latest
118+
119+ steps :
120+ - name : Checkout main branch
121+ uses : actions/checkout@v4
122+ with :
123+ ref : main
124+ fetch-depth : 0
115125
116126 - name : Setup Git
117127 run : |
118128 git config --global user.name "${{ github.actor }}"
119129 git config --global user.email "${{ github.actor }}@users.noreply.github.com"
120- git fetch --tags
121- git pull
130+
131+ - name : Setup Node.js
132+ uses : actions/setup-node@v4
133+ with :
134+ node-version : 22.x
122135
123136 - name : Setup global dependencies
124137 run : |
@@ -129,35 +142,22 @@ jobs:
129142 run : |
130143 yarn install --frozen-lockfile --registry="https://registry.yarnpkg.com"
131144
132- - name : Download build artifacts
133- uses : actions/download-artifact@v4
134- with :
135- name : build
136-
137- - name : Publish to npm
145+ - name : Apply version changes
138146 run : |
139- zx scripts/workflow/npm-publish .mjs
147+ zx scripts/workflow/set-package-version .mjs
140148 env :
141- NPM_CONFIG_PROVENANCE : true
149+ TAG : ${{ needs.build.outputs.tag }}
142150
143- - name : Commit version changes
151+ - name : Commit and push to release branch
144152 uses : EndBug/add-and-commit@v9
145153 with :
146154 add : " ."
147155 default_author : github_actor
148156 fetch : true
149157 new_branch : release
150158 push : ' --set-upstream origin release --force'
151- message : ' chore(release): publish npm version ${{ needs.build.outputs.tag }}'
152-
153- create_release_pr :
154- permissions :
155- pull-requests : write
156-
157- needs : [build, release_npm]
158- runs-on : ubuntu-latest
159+ message : ' chore(release): update version to ${{ needs.build.outputs.tag }}'
159160
160- steps :
161161 - name : Create or update PR
162162 uses : actions/github-script@v7
163163 env :
0 commit comments