Skip to content

Commit 6a63e24

Browse files
authored
Add automated release pipeline (#2932)
1 parent 58cad68 commit 6a63e24

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed

eng/ci/publish.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# This is our package-publishing pipeline.
2+
# When executed, it automatically publishes the output of the 'official pipeline' (the nupkgs) to our internal ADO feed.
3+
# It may optionally also publish the packages to NuGet, but that is gated behind a manual approval.
4+
5+
trigger: none # only trigger is manual
6+
pr: none # only trigger is manual
7+
8+
# We include to this variable group to be able to access the NuGet API key
9+
variables:
10+
- group: durabletask_config
11+
12+
resources:
13+
repositories:
14+
- repository: 1es
15+
type: git
16+
name: 1ESPipelineTemplates/1ESPipelineTemplates
17+
ref: refs/tags/release
18+
- repository: eng
19+
type: git
20+
name: engineering
21+
ref: refs/tags/release
22+
23+
pipelines:
24+
- pipeline: officialPipeline # Reference to the pipeline to be used as an artifact source
25+
source: 'durabletask-extension.official'
26+
27+
extends:
28+
template: v1/1ES.Official.PipelineTemplate.yml@1es
29+
parameters:
30+
pool:
31+
name: 1es-pool-azfunc
32+
image: 1es-windows-2022
33+
os: windows
34+
35+
stages:
36+
- stage: release
37+
jobs:
38+
39+
# ADO release
40+
- job: adoRelease
41+
displayName: ADO Release
42+
templateContext:
43+
inputs:
44+
- input: pipelineArtifact
45+
pipeline: officialPipeline # Pipeline reference, as defined in the resources section
46+
artifactName: drop
47+
targetPath: $(System.DefaultWorkingDirectory)/drop
48+
49+
# The preferred method of release on 1ES is by populating the 'output' section of a 1ES template.
50+
# We use this method to release to ADO, but not to release to NuGet; this is explained in the 'nugetRelease' job.
51+
# To read more about the 'output syntax', see:
52+
# - https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-pipeline-templates/features/outputs
53+
# - https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-pipeline-templates/features/outputs/nuget-packages
54+
outputs:
55+
- output: nuget # 'nuget' is an output "type" for pushing to NuGet
56+
displayName: 'Push to durabletask ADO feed'
57+
packageParentPath: $(System.DefaultWorkingDirectory) # This needs to be set to some prefix of the `packagesToPush` parameter. Apparently it helps with SDL tooling
58+
packagesToPush: '$(System.DefaultWorkingDirectory)/**/*.nupkg;!$(System.DefaultWorkingDirectory)/**/*.symbols.nupkg'
59+
publishVstsFeed: '3f99e810-c336-441f-8892-84983093ad7f/c895696b-ce37-4fe7-b7ce-74333a04f8bf'
60+
allowPackageConflicts: true
61+
62+
# NuGet approval gate
63+
- job: nugetApproval
64+
displayName: NuGetApproval
65+
pool: server # This task only works when executed on serverl pools, so this needs to be specified
66+
steps:
67+
# Wait for manual approval.
68+
- task: ManualValidation@1
69+
inputs:
70+
instructions: Confirm you want to push to NuGet
71+
onTimeout: 'reject'
72+
73+
# NuGet release
74+
- job: nugetRelease
75+
displayName: NuGet Release
76+
dependsOn:
77+
- nugetApproval
78+
- adoRelease
79+
condition: succeeded('nugetApproval', 'adoRelease')
80+
templateContext:
81+
inputs:
82+
- input: pipelineArtifact
83+
pipeline: officialPipeline # Pipeline reference as defined in the resources section
84+
artifactName: drop
85+
targetPath: $(System.DefaultWorkingDirectory)/drop
86+
# Ideally, we would push to NuGet using the 1ES "template output" syntax, like we do for ADO.
87+
# Unfortunately, that syntax does not allow for skipping duplicates when pushing to NuGet feeds
88+
# (i.e; not failing the job when trying to push a package version that already exists on NuGet).
89+
# This is a problem for us because our pipelines often produce multiple packages, and we want to be able to
90+
# perform a 'nuget push *.nupkg' that skips packages already on NuGet while pushing the rest.
91+
# Therefore, we use a regular .NET Core ADO Task to publish the packages until that usability gap is addressed.
92+
steps:
93+
- task: DotNetCoreCLI@2
94+
displayName: 'Push to nuget.org'
95+
inputs:
96+
command: custom
97+
custom: nuget
98+
arguments: 'push "*.nupkg" --api-key $(nuget_api_key) --skip-duplicate --source https://api.nuget.org/v3/index.json'
99+
workingDirectory: '$(System.DefaultWorkingDirectory)/drop'

0 commit comments

Comments
 (0)