Skip to content

Add new ESRP + changesets publish system - #3687

Draft
Jake Bailey (jakebailey) wants to merge 8 commits into
microsoft:v2from
jakebailey:azdo-esrp-changesets-publish
Draft

Jake Bailey (jakebailey) wants to merge 8 commits into
microsoft:v2from
jakebailey:azdo-esrp-changesets-publish

Conversation

@jakebailey

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The release logic can skip unpublished versions in multi-commit pushes, and proxy opt-in is missing for token creation and revocation tasks.

2 open issues
What changed in this PR

Moves npm publishing from GitHub Actions to an Azure Pipelines ESRP release flow, while retaining Changesets for version management.

Changes:

  • Adds dependency-ordered package staging and ESRP publishing.
  • Adds retry-aware npm checks and GitHub tag/release creation using a Key Vault-backed GitHub App token.
  • Removes direct publishing from GitHub Actions and adds a required CI check for publish-stage capacity.
File Description
build/​azure-pipelines/​steps/​create-github-app-token.yml Creates and revokes GitHub App tokens using Azure Key Vault.
build/​azure-pipelines/​release.yml Defines build, ESRP publish, and GitHub finalization stages.
build/​azure-pipelines/​release-helper.mjs Checks existing npm versions and creates GitHub tags and releases.
build/​azure-pipelines/​pack-changed-packages.mjs Selects version changes and stages package archives in dependency order.
.github/​workflows/​publish-packages.yml Removes direct npm publishing and its token environment variable.
.github/​workflows/​CI.yml Adds required validation of release-pipeline stage capacity.

Review effort: Balanced

Comment thread build/azure-pipelines/release.yml Resolved
Packages need to be published to npm through ESRP rather than with an
npm token stored in GitHub Actions. ESRP can only be used from an Azure
Pipelines release job, so changesets can no longer publish packages
itself.

Add a release pipeline that runs on every push to v2. Like the
existing single-package release pipelines, it publishes the package
versions changed by the latest commit, which for changesets is the
merged "Version Packages" PR, and does nothing otherwise.

Packages are published one ESRP release per level of the workspace
dependency graph, so a failed release never leaves a published package
depending on an unpublished version. A CI job checks that the pipeline
defines enough stages for the current graph.

All stages run in one job, so retrying a partially failed run would
resubmit packages that already succeeded, which ESRP rejects. Before
each stage, skip any versions that are already on npm.
The release pipeline now publishes packages through ESRP, so
changesets/action only needs to open the "Version Packages" PR.
When changesets/action published packages itself, it also pushed a
name@version tag and created a GitHub release with the changelog entry
for each package. Publishing through ESRP dropped both. Recreate them
from the publish manifest once publishing finishes, so a release looks
the same as before.

This reuses the GitHub App token template from tslib's release pipeline,
since release jobs have no checkout to run the token CLI from.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Private MicroBuild/ESRP dependencies and unavailable Azure configuration require maintainer validation through a controlled end-to-end run covering publishing, finalization, and token cleanup.

2 open issues

Review effort: Balanced

The release pipeline runs under network isolation that blocks
registry.npmjs.org, and the typescriptlang-org bootstrap fetches
TypeScript's dist-tags from there, so the Build stage would fail. None
of the published packages depend on the site, so bootstrap everything
else.
The check was meant to skip versions that an earlier attempt already
published, so that rerunning a partially failed run wouldn't resubmit
them. But the release job's network isolation blocks registry.npmjs.org,
so the check could never succeed, and it isn't needed anyway: ESRP
succeeds for versions that are already on npm.

Have the build report which stages have packages instead, so the publish
job no longer needs Node or the network.
Upstream's publish script ran `changeset git-tag` before publishing,
and changesets/action pushed the tags it reported and created a GitHub
release for each. The action can still do that without publishing, so
run `changeset git-tag` as its publish script instead of recreating the
same thing in the release pipeline.

This replaces the Finalize stage, its helper script and the GitHub App
token template. Tags and releases now appear when the "Version
Packages" PR is merged rather than after ESRP finishes.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The production publishing path depends on unavailable internal MicroBuild/ESRP templates and agent network policy, requiring an end-to-end release to validate template expansion, artifact transfer, and publishing authorization.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

Changesets also patches sandbox and twoslash, which depend on vfs, so
the first release exercises both publish levels.

This branch has not been deployed

No deployments
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.

3 participants