Skip to content

Commit b76a760

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. Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
1 parent f904a20 commit b76a760

1 file changed

Lines changed: 110 additions & 1 deletion

File tree

.azure-pipelines/release.yml

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

0 commit comments

Comments
 (0)