Skip to content

Commit fc557f4

Browse files
authored
Merge pull request #6140 from Cosifne/dev/shech/autoTagRoslyn
Allow release pipeline to automatically create tag in Roslyn and vscode-csharp
2 parents b157974 + 04e8f56 commit fc557f4

File tree

5 files changed

+266
-86
lines changed

5 files changed

+266
-86
lines changed

azure-pipelines/release.yml

Lines changed: 99 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -15,72 +15,109 @@ parameters:
1515
variables:
1616
# This is expected to provide VisualStudioMarketplacePAT to the release (https://code.visualstudio.com/api/working-with-extensions/publishing-extension#get-a-personal-access-token)
1717
- group: vscode-csharp release secrets
18+
# This is expected to provide pat to tag release.
19+
- group: DncEng-Partners-Tokens
1820

19-
jobs:
20-
- deployment: PublishToMarketplace
21-
displayName: PublishToMarketplace
22-
environment: vscode-csharp-release-approvals
23-
pool:
24-
vmImage: ubuntu-latest
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-
}
21+
stages:
22+
- stage: PublishStage
23+
jobs:
24+
- deployment: PublishToMarketplace
25+
displayName: PublishToMarketplace
26+
environment: vscode-csharp-release-approvals
27+
pool:
28+
vmImage: ubuntu-latest
29+
strategy:
30+
runOnce:
31+
deploy:
32+
steps:
33+
- download: 'none'
34+
- task: DownloadPipelineArtifact@2
35+
displayName: '📦 Download artifacts from build pipeline.'
36+
inputs:
37+
buildType: 'specific'
38+
project: 'internal'
39+
definition: 1264
40+
buildVersionToDownload: 'specific'
41+
buildId: '$(resources.pipeline.officialBuildCI.runID)'
42+
branchName: '$(resources.pipeline.officialBuildCI.sourceBranch)'
43+
- pwsh: |
44+
npm install --global vsce
45+
displayName: 'Install vsce'
46+
- pwsh: |
47+
# Our build pipeline would generated build based on attempt number. Publishing the latest attempt.
48+
$allArtifacts = Get-ChildItem -Path "VSIXs - Attempt*" | Sort-Object -Descending
49+
if ($allArtifacts.Length -eq 0) {
50+
throw "No Artifacts is downloaded."
51+
}
4852
49-
$publishArtifacts = $allArtifacts[0]
50-
Write-Host "All artifacts: $($allArtifacts). Publishing $($publishArtifacts)."
53+
$publishArtifacts = $allArtifacts[0]
54+
Write-Host "All artifacts: $($allArtifacts). Publishing $($publishArtifacts)."
5155
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'
56+
$additionalPublishArgs = , "publish"
57+
# 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
58+
If ("$(resources.pipeline.officialBuildCI.sourceBranch)" -eq "refs/heads/main") {
59+
$additionalPublishArgs += "--pre-release"
60+
Write-Host "Publish to pre-release channel."
61+
} ElseIf ("$(resources.pipeline.officialBuildCI.sourceBranch)" -eq "refs/heads/release") {
62+
Write-Host "Publish to release channel."
63+
} Else {
64+
throw "Unexpected branch name: $(resources.pipeline.officialBuildCI.sourceBranch)."
65+
}
66+
$additionalPublishArgs += '--packagePath'
6367
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
68+
$platforms = "arm64", "x64", "ia32"
69+
$allVsixs = Get-ChildItem $publishArtifacts *.vsix
70+
foreach ($vsix in $allVsixs) {
71+
foreach ($plat in $platforms) {
72+
if ($vsix.Name.Contains($plat)) {
73+
$additionalPublishArgs += $vsix
74+
}
7075
}
7176
}
72-
}
7377
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)
78+
Write-Host "Command run is: vsce $($additionalPublishArgs)."
79+
If ("${{ parameters.test }}") {
80+
Write-Host "In test mode, command is printed instead of run."
81+
Write-Host "🔒 Verify PAT."
82+
vsce verify-pat ms-dotnettools
83+
}
84+
Else {
85+
vsce @additionalPublishArgs
86+
}
87+
displayName: 🚀 Publish to Marketplace
88+
workingDirectory: $(Pipeline.Workspace)
89+
env:
90+
VSCE_PAT: $(VSCodeMarketplacePAT)
91+
- stage: 'TagRelease'
92+
displayName: 'Tag release of vscode-csharp'
93+
dependsOn: 'PublishStage'
94+
condition: and(succeeded('PublishStage'), eq(variables['resources.pipeline.officialBuildCI.sourceBranch'], 'refs/heads/release'))
95+
jobs:
96+
- job: 'Tag'
97+
pool:
98+
vmImage: ubuntu-latest
99+
steps:
100+
- task: NodeTool@0
101+
displayName: 'Install Node.js 18.x'
102+
inputs:
103+
versionSpec: '18.x'
104+
- checkout: self
105+
clean: true
106+
submodules: true
107+
fetchTags: false
108+
fetchDepth: 0
109+
- pwsh: |
110+
git checkout $(resources.pipeline.officialBuildCI.sourceCommit)
111+
displayName: 'Checkout to release branch'
112+
- pwsh: |
113+
npm ci
114+
npm install
115+
npm install -g gulp
116+
gulp installDependencies
117+
displayName: 'Install dependencies.'
118+
- pwsh: |
119+
# build number is generated by nerdbank git versioning and set to AzureDev
120+
gulp createTags --releaseVersion $(resources.pipeline.officialBuildCI.runName) --releaseCommit $(resources.pipeline.officialBuildCI.sourceCommit) --dryRun ${{ parameters.test }}
121+
env:
122+
GitHubPAT: $(BotAccount-dotnet-bot-content-rw-grained-pat)
123+
displayName: 'Create release tags'

gulpfile.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ require('./tasks/testTasks');
1111
require('./tasks/offlinePackagingTasks');
1212
require('./tasks/backcompatTasks');
1313
require('./tasks/localizationTasks');
14+
require('./tasks/createTagsTasks');
1415

1516
// Disable warning about wanting an async function
1617
// tslint:disable-next-line

package-lock.json

Lines changed: 23 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4989,4 +4989,4 @@
49894989
}
49904990
]
49914991
}
4992-
}
4992+
}

0 commit comments

Comments
 (0)