-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
62 lines (57 loc) · 2 KB
/
azure-pipelines.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
# name is required for byBuildNumber versioningScheme
# see https://learn.microsoft.com/en-us/azure/devops/pipelines/artifacts/nuget?view=azure-devops&tabs=yaml#package-versioning
name: $(Major).$(Minor).$(NumberOfBuilds)
variables:
Major: '0'
Minor: '1'
MajorMinorVersion: ${{ format('{0}.{1}', variables['Major'], variables['Minor']) }}
# NumberOfBuilds counter is automatically incremented by one in each pipeline execution
# second parameter is a seed value, resets when referenced MajorMinorVersion is changed
# see https://stackoverflow.com/a/56111209
NumberOfBuilds: $[counter(variables['MajorMinorVersion'], 0)]
trigger:
- main
pool:
vmImage: ubuntu-latest
jobs:
- job: CI
steps:
- task: DotNetCoreCLI@2
inputs:
command: 'build'
projects: '*.sln'
arguments: '--configuration Release'
- task: DotNetCoreCLI@2
inputs:
command: 'test'
projects: '*.sln'
arguments: '--configuration Release --no-build --no-restore --collect:"XPlat Code Coverage" --settings:.runsettings'
- task: PublishCodeCoverageResults@2
inputs:
summaryFileLocation: $(Agent.TempDirectory)/**/coverage.cobertura.xml
- task: DotNetCoreCLI@2
inputs:
command: 'pack'
packagesToPack: 'src/EnergySavingMode/*.csproj'
nobuild: true
versioningScheme: byBuildNumber
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
publishLocation: 'pipeline'
artifact: 'nuget'
- deployment: CD
dependsOn: CI
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
environment: 'Azure'
strategy:
runOnce:
deploy:
steps:
- task: NuGetCommand@2
displayName: 'NuGet push'
inputs:
command: 'push'
packagesToPush: '$(Pipeline.Workspace)/nuget/*.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'Azure DevOps nuget publish'