Skip to content

Make release job resilient to npm duplicate-version publish conflicts#2985

Draft
Copilot wants to merge 2 commits into
developfrom
copilot/fix-release-job-failure
Draft

Make release job resilient to npm duplicate-version publish conflicts#2985
Copilot wants to merge 2 commits into
developfrom
copilot/fix-release-job-failure

Conversation

Copilot AI commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

A release workflow run failed because @semantic-release/npm aborted when attempting to publish a version already present on npm (You cannot publish over the previously published versions).
This PR makes that specific condition a skip/no-op so multi-package release can continue, while preserving hard-fail behavior for all other publish errors.

  • Root cause
    • npm publish for @stoplight/spectral-formats@1.8.3 returned duplicate-version error; multi-semantic-release treated it as fatal.
  • Change
    • Added patches/@semantic-release+npm+13.1.5.patch.
    • Wrapped npm publish in guarded error handling for the known duplicate-version message.
  • Resulting behavior
    • Already-published package versions are skipped with explicit logging.
    • Non-matching publish failures are still thrown and fail release.
try {
  await result;
} catch (error) {
  const output = `${error?.stdout ?? ""}\n${error?.stderr ?? ""}`;
  if (/cannot publish over the previously published versions/i.test(output)) {
    logger.log(`Skipped publishing ${pkg.name}@${version} because it is already present on ${registry}`);
    return false;
  }
  throw error;
}

Checklist

  • Tests added / updated
  • Docs added / updated

Does this PR introduce a breaking change?

  • Yes
  • No

Screenshots

Not applicable.

Additional context

Scope is intentionally limited to release-time patch behavior (@semantic-release/npm via patch-package); no workflow YAML or package publish configuration changes were introduced.

Copilot AI changed the title [WIP] Fix failing GitHub Actions job release Make release job resilient to npm duplicate-version publish conflicts Jun 30, 2026
Copilot finished work on behalf of tekyu June 30, 2026 11:36
Copilot AI requested a review from tekyu June 30, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants