Skip to content

Commit 4e0c957

Browse files
committed
Pipeline-ify release process
This sets up the Azure DevOps release pipeline to not only build, test, and sign the bits for a release (and to do so using signed PowerShellEditorServices bits), but to automatically create the GitHub draft release where it directly uploads the artifacts. After manual approval, it will automatically publish the extension and installation script to their respective registries (the Visual Studio Code marketplace and the PowerShell Gallery). Best of all, this process is kicked off automatically after a successful release build of PowerShellEditorServices.
1 parent a987d4d commit 4e0c957

File tree

4 files changed

+120
-62
lines changed

4 files changed

+120
-62
lines changed

.vsts-ci/azure-pipelines-release.yml

Lines changed: 65 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,72 @@ resources:
1414
repositories:
1515
- repository: ComplianceRepo
1616
type: github
17-
endpoint: ComplianceGHRepo
17+
endpoint: GitHub
1818
name: PowerShell/Compliance
19+
20+
- repository: PowerShellEditorServices
21+
type: git
22+
name: PowerShellEditorServices
23+
ref: release
24+
1925
pipelines:
2026
- pipeline: PowerShellEditorServices
2127
source: PowerShellEditorServices
22-
trigger: true
23-
24-
25-
jobs:
26-
- job: 'ReleaseBuild'
27-
displayName: 'Build release'
28-
pool:
29-
name: '1ES'
30-
demands: ImageOverride -equals MMS2019
31-
variables:
32-
- group: ESRP
33-
steps:
34-
- template: templates/release-general.yml
28+
trigger:
29+
stages:
30+
- Build
31+
- Sign
32+
33+
stages:
34+
- stage: Build
35+
displayName: Build the release
36+
jobs:
37+
- job: Build
38+
pool:
39+
vmImage: windows-2019
40+
steps:
41+
- template: templates/ci-general.yml
42+
parameters:
43+
usePipelineArtifact: true
44+
45+
- stage: Sign
46+
displayName: Sign the release
47+
jobs:
48+
- job: Sign
49+
pool:
50+
name: 1ES
51+
demands: ImageOverride -equals MMS2019
52+
variables:
53+
- group: ESRP
54+
steps:
55+
- template: templates/release-general.yml
56+
57+
- stage: PublishGitHub
58+
displayName: Publish the draft release
59+
jobs:
60+
- deployment: Publish
61+
environment: vscode-powershell-github
62+
pool:
63+
vmImage: ubuntu-latest
64+
variables:
65+
- group: Publish
66+
strategy:
67+
runOnce:
68+
deploy:
69+
steps:
70+
- template: templates/publish-github.yml
71+
72+
- stage: PublishMarkets
73+
displayName: Publish to marketplace and gallery
74+
jobs:
75+
- deployment: Publish
76+
environment: vscode-powershell-markets
77+
pool:
78+
vmImage: ubuntu-latest
79+
variables:
80+
- group: Publish
81+
strategy:
82+
runOnce:
83+
deploy:
84+
steps:
85+
- template: templates/publish-markets.yml

.vsts-ci/templates/publish-github.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
steps:
2+
- checkout: self
3+
4+
- download: current
5+
artifact: vscode-powershell
6+
displayName: Download signed artifacts
7+
8+
- pwsh: |
9+
$(Build.SourcesDirectory)/tools/setupReleaseTools.ps1 -Token $(GitHubToken)
10+
New-DraftRelease -RepositoryName vscode-powershell -Assets $(Pipeline.Workspace)/vscode-powershell/powershell-*.vsix,$(Pipeline.Workspace)/vscode-powershell/Install-VSCode.ps1
11+
displayName: Drafting a GitHub Release
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
steps:
2+
- checkout: self
3+
4+
- download: current
5+
artifact: vscode-powershell
6+
displayName: Download signed artifacts
7+
8+
- pwsh: |
9+
npm install -g vsce
10+
vsce publish --packagePath $(Pipeline.Workspace)/powershell-*.vsix --pat $(VsceToken)
11+
displayName: Publishing VSIX to VS Code Marketplace
12+
13+
# NOTE: We rarely update this script, so we can ignore errors from the gallery
14+
# caused by us trying to re-publish an updated script.
15+
- pwsh: |
16+
Publish-Script -Path $(Pipeline.Workspace)/Install-VSCode.ps1 -ErrorAction Continue -NuGetApiKey $(GalleryToken)
17+
displayName: Publishing Install-VSCode.ps1 to PowerShell Gallery
Lines changed: 27 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,49 @@
11
steps:
2-
- checkout: self
3-
4-
- pwsh: |
5-
Get-ChildItem -Path env:
6-
displayName: Capture environment
7-
condition: succeededOrFailed()
8-
9-
- task: DownloadPipelineArtifact@2
10-
displayName: 'Download Artifacts from PowerShellEditorServices'
11-
inputs:
12-
source: specific
13-
project: 'PowerShellEditorServices'
14-
pipeline: 36
15-
preferTriggeringPipeline: true
16-
allowPartiallySucceededBuilds: true
17-
artifact: 'PowerShellEditorServices'
18-
path: '$(Build.SourcesDirectory)/PowerShellEditorServices/module/'
19-
20-
- pwsh: |
21-
New-Item -ItemType Directory $(Build.ArtifactStagingDirectory)/vscode-powershell
22-
Install-Module InvokeBuild -Force
23-
Invoke-Build Release
24-
workingDirectory: '$(Build.SourcesDirectory)/vscode-powershell'
25-
26-
- task: PublishTestResults@2
27-
inputs:
28-
testRunner: JUnit
29-
testResultsFiles: '**/test-results.xml'
30-
condition: succeededOrFailed()
2+
- download: current
3+
displayName: Download pipeline artifacts
314

325
- checkout: ComplianceRepo
336

347
- template: EsrpSign.yml@ComplianceRepo
358
parameters:
36-
buildOutputPath: '$(Build.ArtifactStagingDirectory)/vscode-powershell'
37-
signOutputPath: '$(Build.ArtifactStagingDirectory)/Signed'
38-
alwaysCopy: true # So publishing works
39-
certificateId: 'CP-230012' # Authenticode certificate
40-
useMinimatch: true # This enables the use of globbing
9+
buildOutputPath: $(Pipeline.Workspace)/vscode-powershell-unsigned-script-*
10+
signOutputPath: $(Pipeline.Workspace)/signed
11+
alwaysCopy: true
12+
certificateId: CP-230012 # Authenticode certificate
4113
shouldSign: true # We always want to sign
4214
# NOTE: Code AKA *.vsix files are not signed
43-
pattern: |
44-
Install-VSCode.ps1
15+
pattern: Install-VSCode.ps1
16+
17+
# NOTE: Because the scan template doesn't copy (unlike the sign template), we do
18+
# it ourselves so that we can publish one finished artifact.
19+
- task: CopyFiles@2
20+
inputs:
21+
sourceFolder: $(Pipeline.Workspace)/vscode-powershell-vsix-*
22+
targetFolder: $(Pipeline.Workspace)/signed
4523

4624
- template: EsrpScan.yml@ComplianceRepo
4725
parameters:
48-
scanPath: $(Build.ArtifactStagingDirectory)/Signed
49-
pattern: |
50-
*.vsix
26+
scanPath: $(Pipeline.Workspace)/signed
27+
pattern: powershell-*.vsix
5128

52-
- publish: $(Build.ArtifactStagingDirectory)/Signed
53-
artifact: vscode-powershell
54-
displayName: 'Publish signed (and unsigned) artifacts'
29+
- checkout: self
5530

5631
- template: script-module-compliance.yml@ComplianceRepo
5732
parameters:
5833
# component-governance
59-
sourceScanPath: '$(Build.SourcesDirectory)/vscode-powershell'
34+
sourceScanPath: $(Build.SourcesDirectory)/vscode-powershell
6035
# credscan
61-
suppressionsFile: '$(Build.SourcesDirectory)/vscode-powershell/tools/credScan/suppress.json'
36+
suppressionsFile: $(Build.SourcesDirectory)/vscode-powershell/tools/credScan/suppress.json
6237
# TermCheck AKA PoliCheck
63-
targetArgument: '$(Build.SourcesDirectory)/vscode-powershell'
64-
optionsUEPATH: '$(Build.SourcesDirectory)/vscode-powershell/tools/terms/UserExclusions.xml'
38+
targetArgument: $(Build.SourcesDirectory)/vscode-powershell
39+
optionsUEPATH: $(Build.SourcesDirectory)/vscode-powershell/tools/terms/UserExclusions.xml
6540
optionsRulesDBPath: ''
66-
optionsFTPath: '$(Build.SourcesDirectory)/vscode-powershell/tools/terms/FileTypeSet.xml'
41+
optionsFTPath: $(Build.SourcesDirectory)/vscode-powershell/tools/terms/FileTypeSet.xml
6742
# tsa-upload
68-
codeBaseName: 'PowerShell_PowerShellEditorServices_20210201'
43+
codeBaseName: PowerShell_PowerShellEditorServices_20210201
6944
# We don't use any Windows APIs directly, so we don't need API scan
7045
APIScan: false
46+
47+
- publish: $(Pipeline.Workspace)/signed
48+
artifact: vscode-powershell
49+
displayName: Publish signed artifacts

0 commit comments

Comments
 (0)