Skip to content

Commit 8183ac3

Browse files
committed
Auto-trigger release pipeline on main merge and check npm versions before publish
1 parent 85a7565 commit 8183ac3

2 files changed

Lines changed: 31 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pnpm clean
3737
**Semi-auto:**
3838

3939
Follow https://github.com/Azure/autorest.python/blob/main/.github/skills/bump-and-release/SKILL.md to make a release PR.
40-
After it merged, trigger [release pipeline](https://dev.azure.com/azure-sdk/internal/_build?definitionId=1668) to release new version.
40+
After it merged, [release pipeline](https://dev.azure.com/azure-sdk/internal/_build?definitionId=1668) will be triggered automatically to release new version.
4141

4242
## Contributing
4343

eng/pipelines/publish-release.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
# This is a manual pipeline, don't trigger automatically
2-
trigger: none
1+
# Automatically trigger on main branch merges
2+
trigger:
3+
branches:
4+
include:
5+
- main
36
pr: none
47

58
extends:
@@ -28,6 +31,31 @@ extends:
2831
inputs:
2932
versionSpec: 3.10
3033

34+
- script: |
35+
set -e
36+
37+
# Check @azure-tools/typespec-python
38+
TYPESPEC_VERSION=$(node -p "require('./packages/typespec-python/package.json').version")
39+
echo "Checking if @azure-tools/typespec-python@$TYPESPEC_VERSION is already published..."
40+
if npm view @azure-tools/typespec-python@$TYPESPEC_VERSION version 2>/dev/null; then
41+
echo "##vso[task.logissue type=error]@azure-tools/typespec-python@$TYPESPEC_VERSION is already published to npm"
42+
exit 1
43+
fi
44+
echo "@azure-tools/typespec-python@$TYPESPEC_VERSION is not yet published"
45+
46+
# Check @autorest/python
47+
AUTOREST_VERSION=$(node -p "require('./packages/autorest.python/package.json').version")
48+
echo "Checking if @autorest/python@$AUTOREST_VERSION is already published..."
49+
if npm view @autorest/python@$AUTOREST_VERSION version 2>/dev/null; then
50+
echo "##vso[task.logissue type=error]@autorest/python@$AUTOREST_VERSION is already published to npm"
51+
exit 1
52+
fi
53+
echo "@autorest/python@$AUTOREST_VERSION is not yet published"
54+
55+
echo "Version check passed. Proceeding with build and tests."
56+
displayName: Check if versions are already published
57+
workingDirectory: $(Build.SourcesDirectory)
58+
3159
- script: npm install -g pnpm@9.5.0
3260
displayName: Install PNPM 9.5.0
3361

0 commit comments

Comments
 (0)