Skip to content

Commit ef9e241

Browse files
chore: update condition to allow manual trigger of deployment (#1239)
1 parent 7116cb9 commit ef9e241

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

.azure-pipelines/ci-build.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ parameters:
1515
- name: previewBranch
1616
type: string
1717
default: "refs/heads/main"
18+
- name: deployToGitHub
19+
type: boolean
20+
default: false
21+
- name: deployToMaven
22+
type: boolean
23+
default: false
1824

1925
resources:
2026
repositories:
@@ -112,11 +118,12 @@ extends:
112118
targetPath: "$(PACKAGE_PATH)"
113119

114120
- stage: deploy
115-
condition: and(or(contains(variables['build.sourceBranch'], 'refs/tags/v'), eq(variables['build.sourceBranch'], '${{ parameters.previewBranch }}')), succeeded())
121+
# Allow deployment when: 1. build trigger by tag, 2. source branch matches preview branch or 3. manually triggered pipeline. All with succeeded build stage.
122+
condition: and(or(contains(variables['build.sourceBranch'], 'refs/tags/v'), eq(variables['build.sourceBranch'], '${{ parameters.previewBranch }}'),eq(variables['Build.Reason'], 'Manual')), succeeded())
116123
dependsOn: build
117124
jobs:
118125
- deployment: deploy_github
119-
condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded())
126+
condition: or(and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded()), and(eq('${{ parameters.deployToGitHub }}', 'true'), succeeded()))
120127
pool:
121128
name: Azure-Pipelines-1ESPT-ExDShared
122129
os: linux
@@ -192,7 +199,7 @@ extends:
192199

193200
- deployment: deploy_maven
194201
# snapshots are not supported by ESRP release for now, but they are planning to add support. When it happens, simply remove the condition
195-
condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded())
202+
condition: or(and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded()), and(eq('${{ parameters.deployToMaven }}', 'true'), succeeded()))
196203
pool:
197204
name: Azure-Pipelines-1ESPT-ExDShared
198205
os: linux

0 commit comments

Comments
 (0)