-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy pathrelease.yml
130 lines (115 loc) · 4 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
trigger:
- refs/heads/master
- refs/heads/dev
pr: ['dev']
variables:
solution: '**/*.sln'
testProjects: "**/*Tests/*.csproj"
publishProject: "**/*Tool/*.csproj"
buildConfiguration: 'Release'
major: 4
minor: 0
patch: 0
buildnum: $[counter(format('{0}.{1}.{2}',variables['major'],variables['minor'], variables['patch']), 1)]
version: $(major).$(minor).$(patch).$(buildnum)
stages:
- stage: Build
pool:
vmImage: 'windows-latest'
jobs:
- job: Build
steps:
- task: DotNetCoreCLI@2
displayName: 'dotnet build'
inputs:
command: build
projects: '$(solution)'
arguments: '--configuration $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: 'dotnet test'
inputs:
command: test
projects: '$(testProjects)'
arguments: '--configuration $(buildConfiguration) --collect "Code coverage"'
- stage: Publish_Artifacts
pool:
vmImage: 'windows-latest'
jobs:
- job: Publish
steps:
- task: ComponentGovernanceComponentDetection@0
condition: eq(variables['build.sourceBranch'], 'refs/heads/master')
displayName: 'component detection'
- task: notice@0
condition: eq(variables['build.sourceBranch'], 'refs/heads/master')
displayName: 'generate NOTICE file'
inputs:
outputformat: 'text'
- task: DownloadBuildArtifacts@0
condition: eq(variables['build.sourceBranch'], 'refs/heads/master')
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'NOTICE.txt'
downloadPath: '$(Build.SourcesDirectory)/bin/notice'
- task: DotNetCoreCLI@2
displayName: 'dotnet publish'
inputs:
command: 'publish'
projects: '$(publishProject)'
arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
publishWebProjects: false
zipAfterPublish: True
- task: DotNetCoreCLI@2
displayName: 'dotnet pack nugets'
inputs:
command: pack
configuration: '$(buildConfiguration)'
packDirectory: '$(build.artifactStagingDirectory)/nupkgs'
versioningScheme: 'byEnvVar'
versionEnvVar: 'nuget_version'
zipAfterPublish: true
env:
nuget_version: $(version)
- task: ManifestGeneratorTask@0
displayName: 'Generation Task'
inputs:
BuildDropPath: '$(build.artifactStagingDirectory)'
# Publish artifacts
- task: PublishBuildArtifacts@1
displayName: 'publish binary artifacts'
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'FhirAnonymizerBuild'
- task: PublishBuildArtifacts@1
displayName: 'publish nuget artifacts'
inputs:
pathtoPublish: '$(build.artifactStagingDirectory)/nupkgs'
artifactName: 'nuget'
publishLocation: 'container'
- stage: Release
condition: and(succeeded(), eq(variables['build.sourceBranch'], 'refs/heads/master'))
jobs:
- job: Release
pool:
vmImage: 'windows-latest'
steps:
- checkout: none #skip checking out the default repository resource
- task: DownloadBuildArtifacts@0
displayName: 'Download Artifacts'
inputs:
artifactName: FhirAnonymizerBuild
downloadPath: $(System.DefaultWorkingDirectory)
- task: GithubRelease@1
displayName: 'Create GitHub Release'
inputs:
gitHubConnection: microsoft
repositoryName: microsoft/FHIR-Tools-for-Anonymization
action: create
title: v$(major).$(minor).$(patch)
tagSource: userSpecifiedTag
tag: v$(major).$(minor).$(patch)
assets: |
$(System.DefaultWorkingDirectory)/FhirAnonymizerBuild/Microsoft.Health.Fhir.Anonymizer.R4.CommandLineTool.zip
$(System.DefaultWorkingDirectory)/FhirAnonymizerBuild/Microsoft.Health.Fhir.Anonymizer.Stu3.CommandLineTool.zip
$(System.DefaultWorkingDirectory)/FhirAnonymizerBuild/Microsoft.Health.Dicom.Anonymizer.CommandLineTool.zip