From 5e03769c42be09568f233d9a258ce332b97b3ec3 Mon Sep 17 00:00:00 2001 From: Shuai Zhang Date: Mon, 26 Sep 2022 18:56:37 +0800 Subject: [PATCH] chore: only main branch can publish official release --- .azure-pipelines/Clocks.Net/buddy.yml | 4 ---- .azure-pipelines/common/publish.yml | 4 ++-- version.json | 4 +++- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.azure-pipelines/Clocks.Net/buddy.yml b/.azure-pipelines/Clocks.Net/buddy.yml index b6c3d652..5bac694f 100644 --- a/.azure-pipelines/Clocks.Net/buddy.yml +++ b/.azure-pipelines/Clocks.Net/buddy.yml @@ -12,10 +12,6 @@ variables: NUGET_PACKAGES: $(Pipeline.Workspace)/.nuget/packages steps: -- script: exit 1 - displayName: Check if is main branch - condition: ne(variables['Build.SourceBranch'], 'refs/heads/main') - - template: /.azure-pipelines/common/build.yml@self parameters: isOfficial: 'false' diff --git a/.azure-pipelines/common/publish.yml b/.azure-pipelines/common/publish.yml index cdccc480..95ea2580 100644 --- a/.azure-pipelines/common/publish.yml +++ b/.azure-pipelines/common/publish.yml @@ -10,8 +10,8 @@ steps: - script: | git config user.name "Azure DevOps Build Bot" git config user.email "zhangshuai.ustc+devopsbot@gmail.com" - git tag -a "${{ parameters.tagPrefix }}/$(NBGV_CloudBuildNumber)" -m "Created by Azure DevOps Build Pipeline" - git push origin "${{ parameters.tagPrefix }}/$(NBGV_CloudBuildNumber)" + git tag -a "${{ parameters.tagPrefix }}/$(NBGV_SemVer2)" -m "Created by Azure DevOps Build Pipeline" + git push origin "${{ parameters.tagPrefix }}/$(NBGV_SemVer2)" displayName: 'Create git tag' - task: GitHubRelease@0 diff --git a/version.json b/version.json index 8428d04c..2a2931f8 100644 --- a/version.json +++ b/version.json @@ -13,7 +13,9 @@ "nugetPackageVersion": { "semVer": 2 }, - "publicReleaseRefSpec": [], + "publicReleaseRefSpec": [ + "^refs/heads/main$" + ], "cloudBuild": { "buildNumber": { "enabled": false