Skip to content

Commit f4a3173

Browse files
authored
Merge pull request #6139 from dibarbet/dev/dibarbet/release_approvals
Use deployment stage to require a manual approval to run the pipeline
2 parents 9a0e347 + 56614ec commit f4a3173

File tree

1 file changed

+61
-55
lines changed

1 file changed

+61
-55
lines changed

azure-pipelines/release.yml

Lines changed: 61 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -17,64 +17,70 @@ variables:
1717
- group: vscode-csharp release secrets
1818

1919
jobs:
20-
- job: PublishToMarketplace
20+
- deployment: PublishToMarketplace
21+
displayName: PublishToMarketplace
22+
environment: vscode-csharp-release-approvals
2123
pool:
2224
vmImage: ubuntu-latest
23-
steps:
24-
- task: DownloadPipelineArtifact@2
25-
displayName: '📦 Download artifacts from build pipeline.'
26-
inputs:
27-
buildType: 'specific'
28-
project: 'internal'
29-
definition: 1264
30-
buildVersionToDownload: 'specific'
31-
buildId: '$(resources.pipeline.officialBuildCI.runID)'
32-
branchName: '$(resources.pipeline.officialBuildCI.sourceBranch)'
33-
- pwsh: |
34-
npm install --global vsce
35-
displayName: 'Install vsce'
36-
- pwsh: |
37-
# Our build pipeline would generated build based on attempt number. Publishing the latest attempt.
38-
$allArtifacts = Get-ChildItem -Path "VSIXs - Attempt*" | Sort-Object -Descending
39-
if ($allArtifacts.Length -eq 0) {
40-
throw "No Artifacts is downloaded."
41-
}
25+
strategy:
26+
runOnce:
27+
deploy:
28+
steps:
29+
- download: 'none'
30+
- task: DownloadPipelineArtifact@2
31+
displayName: '📦 Download artifacts from build pipeline.'
32+
inputs:
33+
buildType: 'specific'
34+
project: 'internal'
35+
definition: 1264
36+
buildVersionToDownload: 'specific'
37+
buildId: '$(resources.pipeline.officialBuildCI.runID)'
38+
branchName: '$(resources.pipeline.officialBuildCI.sourceBranch)'
39+
- pwsh: |
40+
npm install --global vsce
41+
displayName: 'Install vsce'
42+
- pwsh: |
43+
# Our build pipeline would generated build based on attempt number. Publishing the latest attempt.
44+
$allArtifacts = Get-ChildItem -Path "VSIXs - Attempt*" | Sort-Object -Descending
45+
if ($allArtifacts.Length -eq 0) {
46+
throw "No Artifacts is downloaded."
47+
}
4248
43-
$publishArtifacts = $allArtifacts[0]
44-
Write-Host "All artifacts: $($allArtifacts). Publishing $($publishArtifacts)."
49+
$publishArtifacts = $allArtifacts[0]
50+
Write-Host "All artifacts: $($allArtifacts). Publishing $($publishArtifacts)."
4551
46-
$additionalPublishArgs = , "publish"
47-
# Artifacts are published to either pre-release or release based on the build branch, https://code.visualstudio.com/api/working-with-extensions/publishing-extension#prerelease-extensions
48-
If ("$(resources.pipeline.officialBuildCI.sourceBranch)" -eq "refs/heads/main") {
49-
$additionalPublishArgs += "--pre-release"
50-
Write-Host "Publish to pre-release channel."
51-
} ElseIf ("$(resources.pipeline.officialBuildCI.sourceBranch)" -eq "refs/heads/release") {
52-
Write-Host "Publish to release channel."
53-
} Else {
54-
throw "Unexpected branch name: $(resources.pipeline.officialBuildCI.sourceBranch)."
55-
}
56-
$additionalPublishArgs += '--packagePath'
52+
$additionalPublishArgs = , "publish"
53+
# Artifacts are published to either pre-release or release based on the build branch, https://code.visualstudio.com/api/working-with-extensions/publishing-extension#prerelease-extensions
54+
If ("$(resources.pipeline.officialBuildCI.sourceBranch)" -eq "refs/heads/main") {
55+
$additionalPublishArgs += "--pre-release"
56+
Write-Host "Publish to pre-release channel."
57+
} ElseIf ("$(resources.pipeline.officialBuildCI.sourceBranch)" -eq "refs/heads/release") {
58+
Write-Host "Publish to release channel."
59+
} Else {
60+
throw "Unexpected branch name: $(resources.pipeline.officialBuildCI.sourceBranch)."
61+
}
62+
$additionalPublishArgs += '--packagePath'
5763
58-
$platforms = "arm64", "x64", "ia32"
59-
$allVsixs = Get-ChildItem $publishArtifacts *.vsix
60-
foreach ($vsix in $allVsixs) {
61-
foreach ($plat in $platforms) {
62-
if ($vsix.Name.Contains($plat)) {
63-
$additionalPublishArgs += $vsix
64-
}
65-
}
66-
}
64+
$platforms = "arm64", "x64", "ia32"
65+
$allVsixs = Get-ChildItem $publishArtifacts *.vsix
66+
foreach ($vsix in $allVsixs) {
67+
foreach ($plat in $platforms) {
68+
if ($vsix.Name.Contains($plat)) {
69+
$additionalPublishArgs += $vsix
70+
}
71+
}
72+
}
6773
68-
Write-Host "Command run is: vsce $($additionalPublishArgs)."
69-
If ("${{ parameters.test }}" -eq "true") {
70-
Write-Host "In test mode, command is printed instead of run."
71-
Write-Host "🔒 Verify PAT."
72-
vsce verify-pat ms-dotnettools
73-
}
74-
Else {
75-
vsce @additionalPublishArgs
76-
}
77-
displayName: 🚀 Publish to Marketplace
78-
workingDirectory: $(Pipeline.Workspace)
79-
env:
80-
VSCE_PAT: $(VSCodeMarketplacePAT)
74+
Write-Host "Command run is: vsce $($additionalPublishArgs)."
75+
If ("${{ parameters.test }}" -eq "true") {
76+
Write-Host "In test mode, command is printed instead of run."
77+
Write-Host "🔒 Verify PAT."
78+
vsce verify-pat ms-dotnettools
79+
}
80+
Else {
81+
vsce @additionalPublishArgs
82+
}
83+
displayName: 🚀 Publish to Marketplace
84+
workingDirectory: $(Pipeline.Workspace)
85+
env:
86+
VSCE_PAT: $(VSCodeMarketplacePAT)

0 commit comments

Comments
 (0)