File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -233,6 +233,23 @@ jobs:
233233 --verbose \
234234 --dry-run
235235
236+ # BUILD: Ensure projects are built before publishing
237+ - name : Build affected projects (main)
238+ if : ${{ steps.ctx.outputs.mode == 'main' && steps.affected.outputs.count != '0' }}
239+ run : npx nx run-many -t build --projects "${{ steps.affected.outputs.projects }}" --verbose
240+
241+ - name : Build projects (dispatch)
242+ if : ${{ steps.ctx.outputs.mode == 'dispatch' }}
243+ shell : bash
244+ run : |
245+ set -euo pipefail
246+ scope="${{ steps.ctx.outputs.scope }}"
247+ if [[ -n "$scope" ]]; then
248+ npx nx run-many -t build --projects "$scope" --verbose
249+ else
250+ npx nx run-many -t build --all --verbose
251+ fi
252+
236253 # PUBLISH: OIDC trusted publishing (default). Avoid any lingering token auth.
237254 - name : nx release publish (OIDC)
238255 if : ${{ steps.ctx.outputs.mode != 'tag' && steps.ctx.outputs.dry_run != 'true' && vars.USE_NPM_TOKEN != 'true' && (steps.ctx.outputs.mode != 'main' || steps.affected.outputs.count != '0') }}
@@ -291,6 +308,10 @@ jobs:
291308 npx nx release publish --tag "${{ steps.ctx.outputs.dist_tag }}" --access public --verbose --dry-run
292309
293310 # Tag-triggered publishing: publish the single package referenced by the tag.
311+ - name : Build project before publish (tag)
312+ if : ${{ steps.ctx.outputs.mode == 'tag' }}
313+ run : npx nx build "${{ steps.taginfo.outputs.project }}" --verbose
314+
294315 - name : nx release publish (tag)
295316 if : ${{ steps.ctx.outputs.mode == 'tag' && vars.USE_NPM_TOKEN != 'true' }}
296317 shell : bash
Original file line number Diff line number Diff line change 110110 "@nx/vite:test" : {
111111 "cache" : true ,
112112 "inputs" : [" default" , " ^production" ]
113+ },
114+ "nx-release-publish" : {
115+ "dependsOn" : [" build" ],
116+ "options" : {
117+ "packageRoot" : " {workspaceRoot}/dist/packages/{projectName}"
118+ }
113119 }
114120 },
115121 "useDaemonProcess" : false ,
You can’t perform that action at this time.
0 commit comments