-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathazure-pipelines-tag.yml
113 lines (93 loc) · 3.47 KB
/
azure-pipelines-tag.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
trigger:
tags:
include:
- v*
pool:
vmImage: 'Ubuntu 20.04'
variables:
buildConfiguration: 'Release'
steps:
- task: GitVersion@5
inputs:
runtime: 'core'
- task: UseDotNet@2
inputs:
version: '5.x'
includePreviewVersions: true
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: 'restore'
projects: 'src/*.csproj'
- task: DotNetCoreCLI@2
inputs:
command: 'build'
projects: 'src/*.csproj'
arguments: '--configuration $(buildConfiguration) /p:Version=$(GitVersion.SemVer) /p:InformationalVersion=$(GitVersion.FullSemVer)'
displayName: 'dotnet build $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: 'test'
projects: 'test/*.csproj'
arguments: '--collect:"XPlat Code Coverage"'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: '$(Agent.TempDirectory)/*/coverage.cobertura.xml'
pathToSources: 'src/'
- script: dotnet publish src/*.csproj --configuration $(buildConfiguration) -o $(Build.BinariesDirectory) /p:Version=$(GitVersion.SemVer) /p:InformationalVersion=$(GitVersion.FullSemVer) -r win-x64
displayName: Publish win-x64
- task: ArchiveFiles@2
displayName: 'Archive $(Build.ArtifactStagingDirectory)'
inputs:
includeRootFolder: false
archiveType: zip
archiveFile: '$(Build.ArtifactStagingDirectory)/Eleia-$(GitVersion.SemVer)-win.zip'
- script: rm -rf $(Build.BinariesDirectory)/*
displayName: Clean Binaries Directory
- script: dotnet publish src/*.csproj --configuration $(buildConfiguration) -o $(Build.BinariesDirectory) /p:Version=$(GitVersion.SemVer) /p:InformationalVersion=$(GitVersion.FullSemVer) -r linux-x64
displayName: Publish linux-x64
- task: ArchiveFiles@2
displayName: 'Archive $(Build.ArtifactStagingDirectory)'
inputs:
includeRootFolder: false
archiveType: zip
archiveFile: '$(Build.ArtifactStagingDirectory)/Eleia-$(GitVersion.SemVer)-linux.zip'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/Eleia-$(GitVersion.SemVer)-win.zip'
ArtifactName: 'drop'
publishLocation: 'Container'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/Eleia-$(GitVersion.SemVer)-linux.zip'
ArtifactName: 'drop'
publishLocation: 'Container'
- script: rm -rf $(Build.BinariesDirectory)/*
displayName: Clean Binaries Directory
- script: dotnet publish src/*.csproj --configuration $(buildConfiguration) -o $(Build.BinariesDirectory) /p:Version=$(GitVersion.SemVer) /p:InformationalVersion=$(GitVersion.FullSemVer) -r linux-musl-x64
displayName: Publish linux-musl-x64
- task: Docker@2
displayName: 'Build Docker Image'
inputs:
containerRegistry: 'dcr.ktos.dev Docker Registry'
repository: eleia
command: build
Dockerfile: Dockerfile
buildContext: $(Build.BinariesDirectory)
tags: |
$(GitVersion.SemVer)
latest
- script: |
docker save dcr.ktos.dev/eleia:latest -o $(Build.ArtifactStagingDirectory)/eleia-docker-$(GitVersion.SemVer).tar
gzip $(Build.ArtifactStagingDirectory)/eleia-docker-$(GitVersion.SemVer).tar
displayName: 'Saving Docker Image'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/eleia-docker-$(GitVersion.SemVer).tar.gz'
ArtifactName: 'drop'
publishLocation: 'Container'