From 3b110dfd1a85b9c4edbf66a93ce05a19fdd3908d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 24 Feb 2026 07:53:29 -0800 Subject: [PATCH 1/2] ci: use yarn flag `--tolerate-republish` --- .ado/azure-pipelines.publish.yml | 5 +- .github/scripts/publish-package-if-needed.mts | 64 ------------------- .github/workflows/pr.yml | 3 +- 3 files changed, 4 insertions(+), 68 deletions(-) delete mode 100644 .github/scripts/publish-package-if-needed.mts diff --git a/.ado/azure-pipelines.publish.yml b/.ado/azure-pipelines.publish.yml index 22528c262b..2c08a1e15b 100644 --- a/.ado/azure-pipelines.publish.yml +++ b/.ado/azure-pipelines.publish.yml @@ -75,6 +75,7 @@ extends: displayName: 'yarn buildci [test]' - script: | + yarn config set npmPublishAccess public yarn config set npmPublishRegistry "https://registry.npmjs.org" yarn config set npmAuthToken $(npmAuth) displayName: 'Configure yarn for npm publishing' @@ -83,12 +84,12 @@ extends: - script: | # https://github.com/changesets/changesets/issues/432 # We can't use `changeset publish` because it doesn't support workspaces, so we have to publish each package individually - yarn workspaces foreach --all --topological --no-private \ - exec node $(Build.SourcesDirectory)/.github/scripts/publish-package-if-needed.mts + yarn workspaces foreach --all --topological --no-private npm publish --tolerate-republish displayName: 'Publish NPM Packages' condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), not(${{ parameters.skipNpmPublish }})) - script: | + yarn config unset npmPublishAccess yarn config unset npmAuthToken yarn config unset npmPublishRegistry displayName: 'Cleanup yarn npm config' diff --git a/.github/scripts/publish-package-if-needed.mts b/.github/scripts/publish-package-if-needed.mts deleted file mode 100644 index 7086df2ce5..0000000000 --- a/.github/scripts/publish-package-if-needed.mts +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env node -import { readFileSync } from 'node:fs'; -import { spawnSync } from 'node:child_process'; - -interface PackageJson { - name: string; - version: string; - private?: boolean; -} - -/** - * Publish a single package to npm if needed - * - * This script: - * - Operates on the current workspace directory - * - Checks npm registry before publishing (idempotent - safe to retry) - * - Requires yarn npm authentication to be configured (npmAuthToken) - * - Skips private packages automatically - * - * Usage: - * # In a workspace directory: - * node publish-package-if-needed.mts # Publish for real - * node publish-package-if-needed.mts --dry-run # Simulate publishing - * - * # For all workspaces in topological order: - * yarn workspaces foreach --all --topological --no-private \ - * exec node .github/scripts/publish-package-if-needed.mts - */ - -const isDryRun = process.argv.includes('--dry-run'); - -const packageJson: PackageJson = JSON.parse(readFileSync('package.json', 'utf-8')); -const { name, version, private: isPrivate } = packageJson; - -if (isPrivate) { - console.log(`⊘ Skipping private package: ${name}`); - process.exit(0); -} - -// Check if package@version already exists on npm -const checkResult = spawnSync('npm', ['view', `${name}@${version}`, 'version'], { - encoding: 'utf-8', - stdio: 'pipe', -}); -const alreadyPublished = checkResult.status === 0 && checkResult.stdout.trim() === version; - -if (alreadyPublished) { - console.log(`✓ Already published: ${name}@${version}`); - process.exit(0); -} - -const startMsg = isDryRun ? 'Simulating publish' : 'Publishing'; -const endMsg = isDryRun ? 'Dry-run successful for' : 'Successfully published'; - -console.log(`→ ${startMsg}: ${name}@${version}`); - -const publishArgs = ['npm', 'publish', '--access', 'public']; -if (isDryRun) publishArgs.push('--dry-run'); - -const publishResult = spawnSync('yarn', publishArgs, { stdio: 'inherit' }); -if (publishResult.status !== 0) { - process.exit(publishResult.status ?? 1); -} -console.log(`✓ ${endMsg}: ${name}@${version}`); diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 778ebdedee..b7cbb3015b 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -326,8 +326,7 @@ jobs: - name: Simulate publish run: | - yarn workspaces foreach --all --topological --no-private \ - exec node $(pwd)/.github/scripts/publish-package-if-needed.mts --dry-run + yarn workspaces foreach --all --topological --no-private npm publish --tolerate-republish --dry-run test-links: name: Test repo links From 4056e40eda60b41ebbb1027a220a8c82f37649c2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 24 Feb 2026 08:08:09 -0800 Subject: [PATCH 2/2] double verbose --- .ado/azure-pipelines.publish.yml | 2 +- .github/workflows/pr.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ado/azure-pipelines.publish.yml b/.ado/azure-pipelines.publish.yml index 2c08a1e15b..ae0aee9b62 100644 --- a/.ado/azure-pipelines.publish.yml +++ b/.ado/azure-pipelines.publish.yml @@ -84,7 +84,7 @@ extends: - script: | # https://github.com/changesets/changesets/issues/432 # We can't use `changeset publish` because it doesn't support workspaces, so we have to publish each package individually - yarn workspaces foreach --all --topological --no-private npm publish --tolerate-republish + yarn workspaces foreach -vv --all --topological --no-private npm publish --tolerate-republish displayName: 'Publish NPM Packages' condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), not(${{ parameters.skipNpmPublish }})) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index b7cbb3015b..a9493305c5 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -326,7 +326,7 @@ jobs: - name: Simulate publish run: | - yarn workspaces foreach --all --topological --no-private npm publish --tolerate-republish --dry-run + yarn workspaces foreach -vv --all --topological --no-private npm publish --tolerate-republish --dry-run test-links: name: Test repo links