Skip to content

Commit b38751f

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 29529a1 commit b38751f

File tree

1 file changed

+113
-1
lines changed

1 file changed

+113
-1
lines changed

.azure-pipelines/release.yml

Lines changed: 113 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'
@@ -540,3 +552,103 @@ extends:
540552
# "Parameters": {}
541553
# }
542554
# ]
555+
556+
- stage: release
557+
displayName: 'Release'
558+
dependsOn: build
559+
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/release'))
560+
jobs:
561+
- job: publish
562+
displayName: 'Publish release'
563+
pool:
564+
name: GitClient-1ESHostedPool-intel-pc
565+
image: ubuntu-x86_64-ado1es
566+
os: linux
567+
templateContext:
568+
inputs:
569+
# Installers and packages
570+
- input: pipelineArtifact
571+
artifactName: 'win-x86_installers'
572+
targetPath: $(Pipeline.Workspace)/assets/win-x86
573+
- input: pipelineArtifact
574+
artifactName: 'osx-x64_installers'
575+
targetPath: $(Pipeline.Workspace)/assets/osx-x64
576+
- input: pipelineArtifact
577+
artifactName: 'osx-arm64_installers'
578+
targetPath: $(Pipeline.Workspace)/assets/osx-arm64
579+
- input: pipelineArtifact
580+
artifactName: 'linux-x64_installers'
581+
targetPath: $(Pipeline.Workspace)/assets/linux-x64
582+
- input: pipelineArtifact
583+
artifactName: 'nuget_packages'
584+
targetPath: $(Pipeline.Workspace)/assets/nuget
585+
# Symbols
586+
# Note: Linux symbols are found with the main .tar.gz assets
587+
- input: pipelineArtifact
588+
artifactName: 'win-x86_symbols'
589+
targetPath: $(Pipeline.Workspace)/symbols/win-x86
590+
- input: pipelineArtifact
591+
artifactName: 'osx-x64_symbols'
592+
targetPath: $(Pipeline.Workspace)/symbols/osx-x64
593+
- input: pipelineArtifact
594+
artifactName: 'osx-arm64_symbols'
595+
targetPath: $(Pipeline.Workspace)/symbols/osx-arm64
596+
outputs:
597+
- output: nuget
598+
condition: and(succeeded(), eq('${{ parameters.nuget }}', true))
599+
displayName: 'Publish .NET Tool NuGet package'
600+
packagesToPush: $(Pipeline.Workspace)/assets/nuget/*.nupkg
601+
packageParentPath: $(Pipeline.Workspace)/assets/nuget
602+
nuGetFeedType: external
603+
publishPackageMetadata: true
604+
publishFeedCredentials: $(nugetConnectionName)
605+
steps:
606+
- checkout: self
607+
- task: Bash@3
608+
displayName: 'Get version'
609+
inputs:
610+
targetType: inline
611+
script: |
612+
echo "##vso[task.setvariable variable=VERSION]$(cat ./VERSION | sed -E 's/.[0-9]+$//')"
613+
- task: ArchiveFiles@2
614+
displayName: 'Archive Windows symbols'
615+
inputs:
616+
rootFolderOrFile: '$(Pipeline.Workspace)/symbols/win-x86'
617+
includeRootFolder: false
618+
archiveType: zip
619+
archiveFile: '$(Pipeline.Workspace)/assets/gcm-win-x86-$(VERSION)-symbols.zip'
620+
- task: ArchiveFiles@2
621+
displayName: 'Archive macOS (x64) symbols'
622+
inputs:
623+
rootFolderOrFile: '$(Pipeline.Workspace)/symbols/osx-x64'
624+
includeRootFolder: false
625+
archiveType: tar
626+
archiveFile: '$(Pipeline.Workspace)/assets/gcm-osx-x64-$(VERSION)-symbols.tar.gz'
627+
- task: ArchiveFiles@2
628+
displayName: 'Archive macOS (ARM64) symbols'
629+
inputs:
630+
rootFolderOrFile: '$(Pipeline.Workspace)/symbols/osx-arm64'
631+
includeRootFolder: false
632+
archiveType: tar
633+
archiveFile: '$(Pipeline.Workspace)/assets/gcm-osx-arm64-$(VERSION)-symbols.tar.gz'
634+
- task: GitHubRelease@1
635+
displayName: 'Create Draft GitHub Release'
636+
condition: and(succeeded(), eq('${{ parameters.github }}', true))
637+
inputs:
638+
gitHubConnection: $(githubConnectionName)
639+
repositoryName: git-ecosystem/git-credential-manager
640+
tag: 'v$(VERSION)'
641+
target: release
642+
title: 'GCM $(VERSION)'
643+
isDraft: true
644+
assets: |
645+
$(Pipeline.Workspace)/assets/win-x86/*.exe
646+
$(Pipeline.Workspace)/assets/osx-x64/*.pkg
647+
$(Pipeline.Workspace)/assets/osx-arm64/*.pkg
648+
$(Pipeline.Workspace)/assets/linux-x64/deb/*.deb
649+
$(Pipeline.Workspace)/assets/linux-x64/tar/*.tar.gz
650+
$(Pipeline.Workspace)/assets/nuget/*.nupkg
651+
$(Pipeline.Workspace)/symbols/win-x86/*.zip
652+
$(Pipeline.Workspace)/symbols/osx-x64/*.tar.gz
653+
$(Pipeline.Workspace)/symbols/osx-arm64/*.tar.gz
654+
# Note: Linux symbols are found with the main .tar.gz assets

0 commit comments

Comments
 (0)