-
Notifications
You must be signed in to change notification settings - Fork 109
/
Copy pathazure-pipelines-release.yml
58 lines (56 loc) · 1.96 KB
/
azure-pipelines-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
trigger: none
name: $(Date:yyyyMMdd).$(Rev:r)
variables:
- name: NuGetFeed
value: https://api.nuget.org/v3/index.json
resources:
pipelines:
- pipeline: '_dotnet-crank-ci-official'
project: 'internal'
source: 'dotnet\crank\dotnet-crank-ci-official'
repositories:
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
extends:
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
parameters:
pool:
name: NetCore1ESPool-Internal
image: 1es-windows-2022
stages:
- stage: Publish
jobs:
- job: Publish_Job
displayName: Publish Crank NuGet Packages
condition: succeeded()
timeoutInMinutes: 0
templateContext:
inputs:
- input: pipelineArtifact
pipeline: '_dotnet-crank-ci-official'
artifactName: 'PackageArtifacts'
targetPath: '$(Pipeline.Workspace)/PackageArtifacts'
steps:
- task: NuGetToolInstaller@1
displayName: Install NuGet
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/main')) }}:
- task: PowerShell@2
displayName: Publish NuGet Packages
inputs:
targetType: inline
script: |-
if(!$env:NuGetFeed) {
throw "Missing 'NuGetFeed' variable!"
}
if(!$env:NUGET_API_KEY) {
throw "Missing 'NuGetApiKey' variable!"
}
Get-ChildItem "$(Pipeline.Workspace)\PackageArtifacts\" -Filter *.nupkg | ForEach-Object {
$name = $_.Name
Write-Host "Publishing $name"
nuget push $_.FullName $env:NUGET_API_KEY -Source $env:NuGetFeed
}
env:
NUGET_API_KEY: $(NuGetApiKey)