From f20ebc48d57d2915d7f2d7fcf7b28191245209cb Mon Sep 17 00:00:00 2001 From: ChristopherPHolder Date: Fri, 13 Nov 2026 17:14:21 +0100 Subject: [PATCH] ci: build packages before publishing them nx release publish only runs nx-release-publish tasks and skips their build dependency, so every publish since cli-0.21.5 failed on a missing dist/packages//package.json. --- .github/workflows/publish.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d86c0b7a..08d9d74e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -37,11 +37,17 @@ jobs: cache: npm - name: Install dependencies run: npm ci - - name: Publish packages to npm + - name: Select projects # a tag push (e.g. cli-0.21.4) publishes only its project, a manual run publishes all run: | if [ "$GITHUB_REF_TYPE" = "tag" ]; then - npx nx release publish --projects="${GITHUB_REF_NAME%-*}" + echo "PROJECTS=${GITHUB_REF_NAME%-*}" >> "$GITHUB_ENV" else - npx nx release publish + echo "PROJECTS=cli,nx-plugin" >> "$GITHUB_ENV" fi + - name: Build packages + # `nx release publish` only runs nx-release-publish tasks and skips their + # `build` dependency, so dist/ has to exist before it runs + run: npx nx run-many -t build --projects="$PROJECTS" + - name: Publish packages to npm + run: npx nx release publish --projects="$PROJECTS"