forked from dotnet/Nerdbank.GitVersioning
/
release.yml
104 lines (99 loc) · 3.32 KB
/
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
trigger: none # We only want to trigger manually or based on resources
pr: none
resources:
pipelines:
- pipeline: CI
source: Nerdbank.GitVersioning
trigger:
tags:
- auto-release
stages:
- stage: GitHubRelease
displayName: GitHub Release
jobs:
- deployment: create
pool:
vmImage: ubuntu-latest
environment: No-Approval # Approval is already granted in the release stage.
strategy:
runOnce:
deploy:
steps:
- download: none
- powershell: |
Write-Host "##vso[build.updatebuildnumber]$(resources.pipeline.CI.runName)"
displayName: Set pipeline name
- task: GitHubRelease@1
displayName: GitHub release (create)
inputs:
gitHubConnection: github.com_AArnott_OAuth
repositoryName: $(Build.Repository.Name)
target: $(resources.pipeline.CI.sourceCommit)
tagSource: userSpecifiedTag
tag: v$(resources.pipeline.CI.runName)
title: v$(resources.pipeline.CI.runName)
isDraft: true
changeLogCompareToRelease: lastNonDraftRelease
changeLogType: issueBased
changeLogLabels: |
[
{ "label" : "breaking changes", "displayName" : "Breaking changes", "state" : "closed" },
{ "label" : "bug", "displayName" : "Fixes", "state" : "closed" },
{ "label" : "enhancement", "displayName": "Enhancements", "state" : "closed" }
]
- stage: nuget_org
displayName: nuget.org
dependsOn: GitHubRelease
jobs:
- deployment: push
pool:
vmImage: ubuntu-latest
environment: No-Approval # Approval is already granted in the release stage.
strategy:
runOnce:
deploy:
steps:
- download: CI
artifact: deployables
displayName: Download deployables artifact
patterns: '**/*.*nupkg'
- task: NuGetToolInstaller@1
displayName: Use NuGet 5.x
inputs:
versionSpec: 5.x
- task: NuGetCommand@2
displayName: NuGet push
inputs:
command: push
packagesToPush: $(Pipeline.Workspace)/CI/deployables/*.nupkg
nuGetFeedType: external
publishFeedCredentials: nuget.org
- stage: npmjs_org
displayName: npmjs.org
dependsOn: GitHubRelease
jobs:
- deployment: push
pool:
vmImage: ubuntu-latest
environment: No-Approval # Approval is already granted in the release stage.
strategy:
runOnce:
deploy:
steps:
- download: CI
artifact: deployables
displayName: Download deployables artifact
patterns: '**/*.tgz'
- powershell: |
$tgz = (Get-ChildItem "$(Pipeline.Workspace)/CI/deployables/*.tgz")[0].FullName
npm init -y
npm install $tgz
workingDirectory: $(Agent.TempDirectory)
displayName: Prepare to publish NPM package
- task: Npm@1
displayName: npm publish
inputs:
command: publish
workingDir: $(Agent.TempDirectory)/node_modules/nerdbank-gitversioning
verbose: false
publishEndpoint: npmjs.org