Skip to content

Commit d7403ef

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 <mjcheetham@outlook.com>
1 parent 3f26acf commit d7403ef

1 file changed

Lines changed: 107 additions & 0 deletions

File tree

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

0 commit comments

Comments
 (0)