Skip to content

Commit c6b3925

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 500db35 commit c6b3925

1 file changed

Lines changed: 126 additions & 1 deletion

File tree

.azure-pipelines/release.yml

Lines changed: 126 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,16 @@ resources:
1212
parameters:
1313
- name: 'esrp'
1414
type: boolean
15-
default: false
15+
default: true
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
- name: 'esrpEndpointUrl'
@@ -554,3 +566,116 @@ extends:
554566
# "Parameters": {}
555567
# }
556568
# ]
569+
570+
- stage: release
571+
displayName: 'Release'
572+
dependsOn: [prebuild, build]
573+
condition: and(succeeded(), or(eq('${{ parameters.github }}', true), eq('${{ parameters.nuget }}', true)))
574+
jobs:
575+
- job: github
576+
displayName: 'Publish GitHub release'
577+
condition: and(succeeded(), eq('${{ parameters.github }}', true))
578+
pool:
579+
name: GitClient-1ESHostedPool-intel-pc
580+
image: ubuntu-x86_64-ado1es
581+
os: linux
582+
variables:
583+
version: $[stageDependencies.prebuild.vars.outputs['version.value']]
584+
templateContext:
585+
type: releaseJob
586+
isProduction: true
587+
inputs:
588+
# Installers and packages
589+
- input: pipelineArtifact
590+
artifactName: 'win-x86_installers'
591+
targetPath: $(Pipeline.Workspace)/assets/win-x86
592+
- input: pipelineArtifact
593+
artifactName: 'osx-x64_installers'
594+
targetPath: $(Pipeline.Workspace)/assets/osx-x64
595+
- input: pipelineArtifact
596+
artifactName: 'osx-arm64_installers'
597+
targetPath: $(Pipeline.Workspace)/assets/osx-arm64
598+
- input: pipelineArtifact
599+
artifactName: 'linux-x64_installers'
600+
targetPath: $(Pipeline.Workspace)/assets/linux-x64
601+
- input: pipelineArtifact
602+
artifactName: 'nuget_packages'
603+
targetPath: $(Pipeline.Workspace)/assets/nuget
604+
# Symbols
605+
# Note: Linux symbols are found with the main .tar.gz assets
606+
- input: pipelineArtifact
607+
artifactName: 'win-x86_symbols'
608+
targetPath: $(Pipeline.Workspace)/symbols/win-x86
609+
- input: pipelineArtifact
610+
artifactName: 'osx-x64_symbols'
611+
targetPath: $(Pipeline.Workspace)/symbols/osx-x64
612+
- input: pipelineArtifact
613+
artifactName: 'osx-arm64_symbols'
614+
targetPath: $(Pipeline.Workspace)/symbols/osx-arm64
615+
steps:
616+
- task: ArchiveFiles@2
617+
displayName: 'Archive Windows symbols'
618+
inputs:
619+
rootFolderOrFile: '$(Pipeline.Workspace)/symbols/win-x86'
620+
includeRootFolder: false
621+
archiveType: zip
622+
archiveFile: '$(Pipeline.Workspace)/assets/gcm-win-x86-$(version)-symbols.zip'
623+
- task: ArchiveFiles@2
624+
displayName: 'Archive macOS (x64) symbols'
625+
inputs:
626+
rootFolderOrFile: '$(Pipeline.Workspace)/symbols/osx-x64'
627+
includeRootFolder: false
628+
archiveType: tar
629+
archiveFile: '$(Pipeline.Workspace)/assets/gcm-osx-x64-$(version)-symbols.tar.gz'
630+
- task: ArchiveFiles@2
631+
displayName: 'Archive macOS (ARM64) symbols'
632+
inputs:
633+
rootFolderOrFile: '$(Pipeline.Workspace)/symbols/osx-arm64'
634+
includeRootFolder: false
635+
archiveType: tar
636+
archiveFile: '$(Pipeline.Workspace)/assets/gcm-osx-arm64-$(version)-symbols.tar.gz'
637+
- task: GitHubRelease@1
638+
displayName: 'Create Draft GitHub Release'
639+
condition: and(succeeded(), eq('${{ parameters.github }}', true))
640+
inputs:
641+
gitHubConnection: $(githubConnectionName)
642+
repositoryName: git-ecosystem/git-credential-manager
643+
tag: 'v$(version)'
644+
target: release
645+
title: 'GCM $(version)'
646+
isDraft: true
647+
assets: |
648+
$(Pipeline.Workspace)/assets/win-x86/*.exe
649+
$(Pipeline.Workspace)/assets/osx-x64/*.pkg
650+
$(Pipeline.Workspace)/assets/osx-arm64/*.pkg
651+
$(Pipeline.Workspace)/assets/linux-x64/deb/*.deb
652+
$(Pipeline.Workspace)/assets/linux-x64/tar/*.tar.gz
653+
$(Pipeline.Workspace)/assets/nuget/*.nupkg
654+
$(Pipeline.Workspace)/symbols/win-x86/*.zip
655+
$(Pipeline.Workspace)/symbols/osx-x64/*.tar.gz
656+
$(Pipeline.Workspace)/symbols/osx-arm64/*.tar.gz
657+
# Note: Linux symbols are found with the main .tar.gz assets
658+
659+
- job: nuget
660+
displayName: 'Publish NuGet package'
661+
condition: and(succeeded(), eq('${{ parameters.nuget }}', true))
662+
pool:
663+
name: GitClient-1ESHostedPool-intel-pc
664+
image: ubuntu-x86_64-ado1es
665+
os: linux
666+
variables:
667+
version: $[stageDependencies.prebuild.vars.outputs['version.value']]
668+
templateContext:
669+
inputs:
670+
- input: pipelineArtifact
671+
artifactName: 'nuget_packages'
672+
targetPath: $(Pipeline.Workspace)/assets/nuget
673+
outputs:
674+
- output: nuget
675+
condition: and(succeeded(), eq('${{ parameters.nuget }}', true))
676+
displayName: 'Publish .NET Tool NuGet package'
677+
packagesToPush: $(Pipeline.Workspace)/assets/nuget/*.nupkg
678+
packageParentPath: $(Pipeline.Workspace)/assets/nuget
679+
nuGetFeedType: external
680+
publishPackageMetadata: true
681+
publishFeedCredentials: $(nugetConnectionName)

0 commit comments

Comments
 (0)