Skip to content

Commit ca8e8c9

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 089645c commit ca8e8c9

File tree

1 file changed

+95
-0
lines changed

1 file changed

+95
-0
lines changed

.azure-pipelines/release.yml

Lines changed: 95 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
@@ -702,3 +714,86 @@ extends:
702714
"Parameters": {}
703715
}
704716
]
717+
718+
- stage: release
719+
displayName: 'Release'
720+
dependsOn: [prebuild, build]
721+
condition: and(succeeded(), or(eq('${{ parameters.github }}', true), eq('${{ parameters.nuget }}', true)))
722+
jobs:
723+
- job: github
724+
displayName: 'Publish GitHub release'
725+
condition: and(succeeded(), eq('${{ parameters.github }}', true))
726+
pool:
727+
name: GitClientPME-1ESHostedPool-intel-pc
728+
image: ubuntu-x86_64-ado1es
729+
os: linux
730+
variables:
731+
version: $[stageDependencies.prebuild.vars.outputs['version.value']]
732+
templateContext:
733+
type: releaseJob
734+
isProduction: true
735+
inputs:
736+
# Installers and packages
737+
- input: pipelineArtifact
738+
artifactName: 'win-x86'
739+
targetPath: $(Pipeline.Workspace)/assets/win-x86
740+
- input: pipelineArtifact
741+
artifactName: 'osx-x64'
742+
targetPath: $(Pipeline.Workspace)/assets/osx-x64
743+
- input: pipelineArtifact
744+
artifactName: 'osx-arm64'
745+
targetPath: $(Pipeline.Workspace)/assets/osx-arm64
746+
- input: pipelineArtifact
747+
artifactName: 'linux-x64'
748+
targetPath: $(Pipeline.Workspace)/assets/linux-x64
749+
- input: pipelineArtifact
750+
artifactName: 'dotnet-tool'
751+
targetPath: $(Pipeline.Workspace)/assets/dotnet-tool
752+
steps:
753+
- task: GitHubRelease@1
754+
displayName: 'Create Draft GitHub Release'
755+
condition: and(succeeded(), eq('${{ parameters.github }}', true))
756+
inputs:
757+
gitHubConnection: $(githubConnectionName)
758+
repositoryName: git-ecosystem/git-credential-manager
759+
tag: 'v$(version)'
760+
tagSource: userSpecifiedTag
761+
target: release
762+
title: 'GCM $(version)'
763+
isDraft: true
764+
addChangeLog: false
765+
assets: |
766+
$(Pipeline.Workspace)/assets/win-x86/*.exe
767+
$(Pipeline.Workspace)/assets/win-x86/*.zip
768+
$(Pipeline.Workspace)/assets/osx-x64/*.pkg
769+
$(Pipeline.Workspace)/assets/osx-x64/*.tar.gz
770+
$(Pipeline.Workspace)/assets/osx-arm64/*.pkg
771+
$(Pipeline.Workspace)/assets/osx-arm64/*.tar.gz
772+
$(Pipeline.Workspace)/assets/linux-x64/*.deb
773+
$(Pipeline.Workspace)/assets/linux-x64/*.tar.gz
774+
$(Pipeline.Workspace)/assets/dotnet-tool/*.nupkg
775+
$(Pipeline.Workspace)/assets/dotnet-tool/*.snupkg
776+
777+
- job: nuget
778+
displayName: 'Publish NuGet package'
779+
condition: and(succeeded(), eq('${{ parameters.nuget }}', true))
780+
pool:
781+
name: GitClientPME-1ESHostedPool-intel-pc
782+
image: ubuntu-x86_64-ado1es
783+
os: linux
784+
variables:
785+
version: $[stageDependencies.prebuild.vars.outputs['version.value']]
786+
templateContext:
787+
inputs:
788+
- input: pipelineArtifact
789+
artifactName: 'dotnet-tool'
790+
targetPath: $(Pipeline.Workspace)/assets/dotnet-tool
791+
outputs:
792+
- output: nuget
793+
condition: and(succeeded(), eq('${{ parameters.nuget }}', true))
794+
displayName: 'Publish .NET Tool NuGet package'
795+
packagesToPush: $(Pipeline.Workspace)/assets/dotnet-tool/*.nupkg # TODO: also push symbol packages?
796+
packageParentPath: $(Pipeline.Workspace)/assets/nuget
797+
nuGetFeedType: external
798+
publishPackageMetadata: true
799+
publishFeedCredentials: $(nugetConnectionName)

0 commit comments

Comments
 (0)