@@ -133,6 +133,9 @@ jobs:
133133 uses : actions/download-artifact@v4
134134 with :
135135 path : release-artifacts
136+ - name : Prepare next release
137+ if : github.ref_type == 'branch'
138+ run : ./.scripts/prepare-next-release.ts ${{ github.run_number }} ${{ github.sha }}
136139 - name : Create npm dirs
137140 run : yarn napi create-npm-dir -t .
138141 - name : Move artifacts
@@ -150,26 +153,28 @@ jobs:
150153 omit-heading : true
151154 - run : ' cat ${{ steps.extract-changelog.outputs.output-file }}'
152155 - name : Release
156+ id : gh-release
153157 uses : softprops/action-gh-release@v2
154- if : startsWith( github.ref, 'refs/tags/')
158+ if : github.ref_type == 'tag'
155159 with :
156160 body_path : ${{ steps.extract-changelog.outputs.output-file }}
157161 repository : toss/es-git
158162 generate_release_notes : false
159163 token : ${{ github.token }}
160164 - name : Publish
161- if : |
162- github.event_name == 'push' &&
163- (github.ref_type == 'tag' || github.ref == 'refs/heads/main')
164165 run : |
165166 set -ex
166167 npm config set provenance true
167168 npm config set //registry.npmjs.org/:_authToken "$NPM_AUTH_TOKEN"
168169 npm whoami
169170 if [[ "$GITHUB_REF_TYPE" = "tag" ]]; then
171+ yarn napi prepublish -t npm --gh-release-id ${{ steps.gh-release.outputs.id }}
170172 npm publish --access public
171- else
173+ elif [[ "$GITHUB_REF_TYPE" = "branch" ]]; then
174+ yarn napi prepublish -t npm --skip-gh-release
172175 npm publish --access public --tag next
176+ else
177+ echo "Skip publish"
173178 fi
174179 env :
175180 GITHUB_TOKEN : ${{ github.token }}
0 commit comments