From 9287da15e03f5b00a9f10757e17d1d7d6c8df690 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Fri, 6 Feb 2026 12:58:26 +0800 Subject: [PATCH 1/2] Auto-trigger release pipeline on main merge and add version check --- README.md | 2 +- eng/pipelines/publish-release.yml | 32 +++++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0f73dd59cbb..57776abc131 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ pnpm clean **Semi-auto:** Follow https://github.com/Azure/autorest.python/blob/main/.github/skills/bump-and-release/SKILL.md to make a release PR. -After it merged, trigger [release pipeline](https://dev.azure.com/azure-sdk/internal/_build?definitionId=1668) to release new version. +After it merged, [release pipeline](https://dev.azure.com/azure-sdk/internal/_build?definitionId=1668) will be triggered automatically to release new version. ## Contributing diff --git a/eng/pipelines/publish-release.yml b/eng/pipelines/publish-release.yml index f3f60666921..d2853baffb2 100644 --- a/eng/pipelines/publish-release.yml +++ b/eng/pipelines/publish-release.yml @@ -1,5 +1,8 @@ -# This is a manual pipeline, don't trigger automatically -trigger: none +# Automatically trigger on main branch merges +trigger: + branches: + include: + - main pr: none extends: @@ -28,6 +31,31 @@ extends: inputs: versionSpec: 3.10 + - script: | + set -e + + # Check @azure-tools/typespec-python + TYPESPEC_VERSION=$(node -p "require('./packages/typespec-python/package.json').version") + echo "Checking if @azure-tools/typespec-python@$TYPESPEC_VERSION is already published..." + if npm view @azure-tools/typespec-python@$TYPESPEC_VERSION version 2>/dev/null; then + echo "##vso[task.logissue type=error]@azure-tools/typespec-python@$TYPESPEC_VERSION is already published to npm" + exit 1 + fi + echo "@azure-tools/typespec-python@$TYPESPEC_VERSION is not yet published" + + # Check @autorest/python + AUTOREST_VERSION=$(node -p "require('./packages/autorest.python/package.json').version") + echo "Checking if @autorest/python@$AUTOREST_VERSION is already published..." + if npm view @autorest/python@$AUTOREST_VERSION version 2>/dev/null; then + echo "##vso[task.logissue type=error]@autorest/python@$AUTOREST_VERSION is already published to npm" + exit 1 + fi + echo "@autorest/python@$AUTOREST_VERSION is not yet published" + + echo "Version check passed. Proceeding with build and tests." + displayName: Check if versions are already published + workingDirectory: $(Build.SourcesDirectory) + - script: npm install -g pnpm@9.5.0 displayName: Install PNPM 9.5.0 From 665f0d47ec98d5e7c5b209e5d7878c8e54b5ee35 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Fri, 6 Feb 2026 13:25:43 +0800 Subject: [PATCH 2/2] Simplify trigger syntax in publish-release.yml --- eng/pipelines/publish-release.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/eng/pipelines/publish-release.yml b/eng/pipelines/publish-release.yml index d2853baffb2..ec0bfb9d314 100644 --- a/eng/pipelines/publish-release.yml +++ b/eng/pipelines/publish-release.yml @@ -1,8 +1,6 @@ -# Automatically trigger on main branch merges +# Trigger only after PR merged into main trigger: - branches: - include: - - main + - main pr: none extends: