From d247f6109680b3820fbd528509da45ca7d1ca6eb Mon Sep 17 00:00:00 2001 From: Matsu Date: Thu, 7 May 2026 09:44:17 +0300 Subject: [PATCH] ci: Flip order of npm releases for idempotency (#29958) --- .github/workflows/release-publish.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index 8ee79cdaec5..6847cff902a 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -76,11 +76,9 @@ jobs: cp README.md packages/cli/README.md sed -i "s/default: 'dev'/default: '${{ needs.determine-version-info.outputs.release_type }}'/g" packages/cli/dist/config/schema.js - - name: Publish n8n to NPM with rc tag - env: - PUBLISH_BRANCH: ${{ github.event.pull_request.base.ref }} - run: pnpm --filter n8n publish --publish-branch "$PUBLISH_BRANCH" --access public --tag rc --no-git-checks - + # Publishing via `pnpm publish -r` is idempotent, as it checks if the package exists + # and only publishes if it doesn't. This is why we do the sub-packages before the main n8n package. + # So if anything goes wrong, we can easily re-try the run instead of abandoning the release. - name: Publish other packages to NPM env: PUBLISH_BRANCH: ${{ github.event.pull_request.base.ref }} @@ -92,6 +90,12 @@ jobs: fi pnpm publish -r --filter '!n8n' --publish-branch "$PUBLISH_BRANCH" --access public --tag "$PUBLISH_TAG" --no-git-checks + # If we don't use the --tag rc, all releases will default to "latest". + - name: Publish n8n to NPM with rc tag + env: + PUBLISH_BRANCH: ${{ github.event.pull_request.base.ref }} + run: pnpm --filter n8n publish --publish-branch "$PUBLISH_BRANCH" --access public --tag rc --no-git-checks + - name: Cleanup rc tag run: npm dist-tag rm n8n rc continue-on-error: true