Skip to content

Commit 18825d3

Browse files
Microsoft Graph DevX ToolingCopilot
authored andcommitted
ci: restore release tag package-version equality check
Preserve the original inline check with v-prefix matching and retain the v*.*.* tag trigger at line 9. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 46b9e11 commit 18825d3

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

‎.azure-pipelines/ci-build-production.yml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,18 @@ extends:
8282
version: '22.x'
8383
displayName: Install Node.js
8484

85+
- script: |
86+
node -e "
87+
const version = require('./package.json').version;
88+
const branch = process.env.BUILD_SOURCEBRANCH;
89+
if (branch.startsWith('refs/tags/')) {
90+
const tag = branch.slice('refs/tags/'.length);
91+
if (tag !== 'v' + version) {
92+
throw new Error('Release tag ' + tag + ' must match package version: v' + version);
93+
}
94+
}
95+
"
96+
displayName: Validate release tag matches package version
8597
- script: npm ci
8698
displayName: Install production build dependencies
8799
- script: npm run build

‎CONTRIBUTING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ The **Build** stage tests the SDK on Windows with Node.js 22, 24, and 26, and bu
146146

147147
To validate the migration before merging, manually queue **Graph JS SDK Build pipeline** against the PR branch. Manual runs never deploy to npm or publish `release-drop`, including manual runs targeting a tag. An Azure DevOps administrator may need to authorize the `1ESPipelineTemplates/1ESPipelineTemplates` repository and the `Azure-Pipelines-1ESPT-ExDShared` pool for this pipeline. Confirm that the pool provides the Windows and Ubuntu images used here, including Chrome for the Windows browser tests, and that the template's SDL checks pass. Download `sdk-build` and inspect/install the tarball in a clean consumer project before releasing.
148148

149-
After a successful validation and merge to `main`, push a release tag in the `vX.X.X` format whose numeric version matches `package.json`, such as `v3.1.0`, on the intended release commit. The tag trigger uses Azure's `v*.*.*` wildcard filter, not a regular expression. It does not enforce numeric components, prohibit suffixes, or verify the package version; release owners must check these before pushing a tag. There is no build-time tag validation. Unprefixed tag pushes do not trigger a release. The separate **Publish** stage runs only after the build and tests succeed, and only for CI runs triggered by a `v`-prefixed tag push. Its production deployment job downloads the same `sdk-build` tarball and submits it to `EsrpRelease@9` for npm package distribution. It also publishes the tarball as `release-drop`; neither packing nor building runs again during deployment. Creating or pushing a release tag is a release action; do not do so for build-only validation.
149+
After a successful validation and merge to `main`, push a release tag in the `vX.X.X` format whose numeric version matches `package.json`, such as `v3.1.0`, on the intended release commit. The tag trigger uses Azure's `v*.*.*` wildcard filter, not a regular expression. A build-time equality check additionally requires the entire tag to equal `v` followed by the package version before packing. It does not independently validate semantic-version syntax. Unprefixed tag pushes do not trigger a release. The separate **Publish** stage runs only after the build and tests succeed, and only for CI runs triggered by a `v`-prefixed tag push. Its production deployment job downloads the same `sdk-build` tarball and submits it to `EsrpRelease@9` for npm package distribution. It also publishes the tarball as `release-drop`; neither packing nor building runs again during deployment. Creating or pushing a release tag is a release action; do not do so for build-only validation.
150150

151151
Deployment reuses the TypeScript SDK's `msgraph-npm-org` environment, federated DevX ESRP service connection, certificate references, and configured release owners/approvers. Before pushing a release tag, authorize this pipeline to use those resources, verify the environment's approval/check policies, confirm ESRP is authorized to distribute `@microsoft/microsoft-graph-client`, and confirm the intended npm dist-tag policy. The shared configuration's name alone does not establish access to this package's `@microsoft` scope. Check that the release version is not already published.
152152

0 commit comments

Comments
 (0)