Skip to content

Commit e54db96

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 6e5000b commit e54db96

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
@@ -57,6 +65,10 @@ parameters:
5765
os: linux
5866

5967
variables:
68+
- name: 'githubConnectionName'
69+
value: 'GitHub-GitCredentialManager'
70+
- name: 'nugetConnectionName'
71+
value: '1ESGitClient-NuGet'
6072
- name: 'esrpConnectionName'
6173
value: '1ESGitClient-ESRP'
6274
# ESRP signing variables set in the pipeline settings:
@@ -618,3 +630,98 @@ extends:
618630
"Parameters": {}
619631
}
620632
]
633+
634+
- stage: release
635+
displayName: 'Release'
636+
dependsOn: [prebuild, build]
637+
condition: and(succeeded(), or(eq('${{ parameters.github }}', true), eq('${{ parameters.nuget }}', true)))
638+
jobs:
639+
- job: github
640+
displayName: 'Publish GitHub release'
641+
condition: and(succeeded(), eq('${{ parameters.github }}', true))
642+
pool:
643+
name: GitClientPME-1ESHostedPool-intel-pc
644+
image: ubuntu-x86_64-ado1es
645+
os: linux
646+
variables:
647+
version: $[stageDependencies.prebuild.vars.outputs['version.value']]
648+
templateContext:
649+
type: releaseJob
650+
isProduction: true
651+
inputs:
652+
# Installers and packages
653+
- input: pipelineArtifact
654+
artifactName: 'win-x86_installers'
655+
targetPath: $(Pipeline.Workspace)/assets/win-x86
656+
- input: pipelineArtifact
657+
artifactName: 'osx-x64_installers'
658+
targetPath: $(Pipeline.Workspace)/assets/osx-x64
659+
- input: pipelineArtifact
660+
artifactName: 'osx-arm64_installers'
661+
targetPath: $(Pipeline.Workspace)/assets/osx-arm64
662+
- input: pipelineArtifact
663+
artifactName: 'linux-x64_installers'
664+
targetPath: $(Pipeline.Workspace)/assets/linux-x64
665+
- input: pipelineArtifact
666+
artifactName: 'nuget_packages'
667+
targetPath: $(Pipeline.Workspace)/assets/nuget
668+
- input: pipelineArtifact
669+
artifactName: 'win-x86_symbols'
670+
targetPath: $(Pipeline.Workspace)/symbols/win-x86
671+
- input: pipelineArtifact
672+
artifactName: 'osx-x64_symbols'
673+
targetPath: $(Pipeline.Workspace)/symbols/osx-x64
674+
- input: pipelineArtifact
675+
artifactName: 'osx-arm64_symbols'
676+
targetPath: $(Pipeline.Workspace)/symbols/osx-arm64
677+
- input: pipelineArtifact
678+
artifactName: 'linux-x64_symbols'
679+
targetPath: $(Pipeline.Workspace)/symbols/linux-x64
680+
steps:
681+
- task: GitHubRelease@1
682+
displayName: 'Create Draft GitHub Release'
683+
condition: and(succeeded(), eq('${{ parameters.github }}', true))
684+
inputs:
685+
gitHubConnection: $(githubConnectionName)
686+
repositoryName: git-ecosystem/git-credential-manager
687+
tag: 'v$(version)'
688+
tagSource: userSpecifiedTag
689+
target: release
690+
title: 'GCM $(version)'
691+
isDraft: true
692+
addChangeLog: false
693+
assets: |
694+
$(Pipeline.Workspace)/assets/win-x86/*.exe
695+
$(Pipeline.Workspace)/assets/osx-x64/*.pkg
696+
$(Pipeline.Workspace)/assets/osx-arm64/*.pkg
697+
$(Pipeline.Workspace)/assets/linux-x64/deb/*.deb
698+
$(Pipeline.Workspace)/assets/linux-x64/tar/*.tar.gz
699+
$(Pipeline.Workspace)/assets/nuget/*.nupkg
700+
$(Pipeline.Workspace)/symbols/win-x86/*.zip
701+
$(Pipeline.Workspace)/symbols/osx-x64/*.tar.gz
702+
$(Pipeline.Workspace)/symbols/osx-arm64/*.tar.gz
703+
$(Pipeline.Workspace)/symbols/linux-x64/*.tar.gz
704+
705+
- job: nuget
706+
displayName: 'Publish NuGet package'
707+
condition: and(succeeded(), eq('${{ parameters.nuget }}', true))
708+
pool:
709+
name: GitClientPME-1ESHostedPool-intel-pc
710+
image: ubuntu-x86_64-ado1es
711+
os: linux
712+
variables:
713+
version: $[stageDependencies.prebuild.vars.outputs['version.value']]
714+
templateContext:
715+
inputs:
716+
- input: pipelineArtifact
717+
artifactName: 'nuget_packages'
718+
targetPath: $(Pipeline.Workspace)/assets/nuget
719+
outputs:
720+
- output: nuget
721+
condition: and(succeeded(), eq('${{ parameters.nuget }}', true))
722+
displayName: 'Publish .NET Tool NuGet package'
723+
packagesToPush: $(Pipeline.Workspace)/assets/nuget/*.nupkg
724+
packageParentPath: $(Pipeline.Workspace)/assets/nuget
725+
nuGetFeedType: external
726+
publishPackageMetadata: true
727+
publishFeedCredentials: $(nugetConnectionName)

0 commit comments

Comments
 (0)