Skip to content

Commit 54a36b1

Browse files
committed
.azure-pipelines/release.yml: add GitHub and NuGet.org publishing
Add a new stage (after build) to publish the assets to GitHub and NuGet.org. Each target (GitHub and NuGet.org) need to run in separate jobs due to restrictions of the 1ES pipeline templates: - Publishing a NuGet package requires us to use template `outputs` - `type: releaseJob` cannot specify outputs - `type: releaseJob` is required to use the `GitHubRelease` task Signed-off-by: Matthew John Cheetham <[email protected]>
1 parent 964f20a commit 54a36b1

File tree

1 file changed

+107
-0
lines changed

1 file changed

+107
-0
lines changed

.azure-pipelines/release.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ parameters:
1414
type: boolean
1515
default: false
1616
displayName: 'Enable ESRP code signing'
17+
- name: 'github'
18+
type: boolean
19+
default: false
20+
displayName: 'Enable GitHub release publishing'
21+
- name: 'nuget'
22+
type: boolean
23+
default: false
24+
displayName: 'Enable NuGet package publishing'
1725

1826
#
1927
# 1ES Pipeline Templates do not allow using a matrix strategy so we create
@@ -61,6 +69,10 @@ variables:
6169
value: '1ESGitClient-ESRP-App'
6270
- name: 'esrpMIConnectionName'
6371
value: '1ESGitClient-ESRP-MI'
72+
- name: 'githubConnectionName'
73+
value: 'GitHub-GitCredentialManager'
74+
- name: 'nugetConnectionName'
75+
value: '1ESGitClient-NuGet'
6476
# ESRP signing variables set in the pipeline settings:
6577
# - esrpEndpointUrl
6678
# - esrpClientId
@@ -669,3 +681,98 @@ extends:
669681
"Parameters": {}
670682
}
671683
]
684+
685+
- stage: release
686+
displayName: 'Release'
687+
dependsOn: [prebuild, build]
688+
condition: and(succeeded(), or(eq('${{ parameters.github }}', true), eq('${{ parameters.nuget }}', true)))
689+
jobs:
690+
- job: github
691+
displayName: 'Publish GitHub release'
692+
condition: and(succeeded(), eq('${{ parameters.github }}', true))
693+
pool:
694+
name: GitClientPME-1ESHostedPool-intel-pc
695+
image: ubuntu-x86_64-ado1es
696+
os: linux
697+
variables:
698+
version: $[stageDependencies.prebuild.vars.outputs['version.value']]
699+
templateContext:
700+
type: releaseJob
701+
isProduction: true
702+
inputs:
703+
# Installers and packages
704+
- input: pipelineArtifact
705+
artifactName: 'win-x86_installers'
706+
targetPath: $(Pipeline.Workspace)/assets/win-x86
707+
- input: pipelineArtifact
708+
artifactName: 'osx-x64_installers'
709+
targetPath: $(Pipeline.Workspace)/assets/osx-x64
710+
- input: pipelineArtifact
711+
artifactName: 'osx-arm64_installers'
712+
targetPath: $(Pipeline.Workspace)/assets/osx-arm64
713+
- input: pipelineArtifact
714+
artifactName: 'linux-x64_installers'
715+
targetPath: $(Pipeline.Workspace)/assets/linux-x64
716+
- input: pipelineArtifact
717+
artifactName: 'nuget_packages'
718+
targetPath: $(Pipeline.Workspace)/assets/nuget
719+
- input: pipelineArtifact
720+
artifactName: 'win-x86_symbols'
721+
targetPath: $(Pipeline.Workspace)/symbols/win-x86
722+
- input: pipelineArtifact
723+
artifactName: 'osx-x64_symbols'
724+
targetPath: $(Pipeline.Workspace)/symbols/osx-x64
725+
- input: pipelineArtifact
726+
artifactName: 'osx-arm64_symbols'
727+
targetPath: $(Pipeline.Workspace)/symbols/osx-arm64
728+
- input: pipelineArtifact
729+
artifactName: 'linux-x64_symbols'
730+
targetPath: $(Pipeline.Workspace)/symbols/linux-x64
731+
steps:
732+
- task: GitHubRelease@1
733+
displayName: 'Create Draft GitHub Release'
734+
condition: and(succeeded(), eq('${{ parameters.github }}', true))
735+
inputs:
736+
gitHubConnection: $(githubConnectionName)
737+
repositoryName: git-ecosystem/git-credential-manager
738+
tag: 'v$(version)'
739+
tagSource: userSpecifiedTag
740+
target: release
741+
title: 'GCM $(version)'
742+
isDraft: true
743+
addChangeLog: false
744+
assets: |
745+
$(Pipeline.Workspace)/assets/win-x86/*.exe
746+
$(Pipeline.Workspace)/assets/osx-x64/*.pkg
747+
$(Pipeline.Workspace)/assets/osx-arm64/*.pkg
748+
$(Pipeline.Workspace)/assets/linux-x64/deb/*.deb
749+
$(Pipeline.Workspace)/assets/linux-x64/tar/*.tar.gz
750+
$(Pipeline.Workspace)/assets/nuget/*.nupkg
751+
$(Pipeline.Workspace)/symbols/win-x86/*.zip
752+
$(Pipeline.Workspace)/symbols/osx-x64/*.tar.gz
753+
$(Pipeline.Workspace)/symbols/osx-arm64/*.tar.gz
754+
$(Pipeline.Workspace)/symbols/linux-x64/*.tar.gz
755+
756+
- job: nuget
757+
displayName: 'Publish NuGet package'
758+
condition: and(succeeded(), eq('${{ parameters.nuget }}', true))
759+
pool:
760+
name: GitClientPME-1ESHostedPool-intel-pc
761+
image: ubuntu-x86_64-ado1es
762+
os: linux
763+
variables:
764+
version: $[stageDependencies.prebuild.vars.outputs['version.value']]
765+
templateContext:
766+
inputs:
767+
- input: pipelineArtifact
768+
artifactName: 'nuget_packages'
769+
targetPath: $(Pipeline.Workspace)/assets/nuget
770+
outputs:
771+
- output: nuget
772+
condition: and(succeeded(), eq('${{ parameters.nuget }}', true))
773+
displayName: 'Publish .NET Tool NuGet package'
774+
packagesToPush: $(Pipeline.Workspace)/assets/nuget/*.nupkg
775+
packageParentPath: $(Pipeline.Workspace)/assets/nuget
776+
nuGetFeedType: external
777+
publishPackageMetadata: true
778+
publishFeedCredentials: $(nugetConnectionName)

0 commit comments

Comments
 (0)