forked from fernandoseguim/amaury
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
155 lines (142 loc) · 4.42 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
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
variables:
MajorVersion: 1
MinorVersion: 0
Patch: 6
PackageVersion: 1.0.6
BuildConfiguration: Release
name: $(MajorVersion).$(MinorVersion).$(Patch)-$(Build.BuildId)
trigger:
branches:
include:
- master
- develop
- feature/*
paths:
include:
- src/*
- test/*
- azure-pipelines.yml
resources:
containers:
- container: dynamodb
image: amazon/dynamodb-local
ports:
- 8000:8000
env:
AWS_ACCESS_KEY_ID: root
AWS_SECRET_ACCESS_KEY: secret
stages:
- stage: Build
jobs:
- job: Build
displayName: Build Artifacts
pool:
vmImage: 'ubuntu-latest'
timeoutInMinutes: 10
services:
dynamodb: dynamodb
steps:
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: restore
projects: '**/*.csproj'
- task: DotNetCoreCLI@2
displayName: Build
inputs:
projects: '**/*.csproj'
arguments: '--configuration $(BuildConfiguration)'
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: test
projects: '**/*[Tt]est*/*.csproj'
arguments: '--configuration $(BuildConfiguration)'
- powershell: |
$packageVersion = $env:majorVersion + "." + $env:minorVersion + "." + $env:patch
Write-Host "##vso[task.setvariable variable=PackageVersion]$packageVersion"
displayName: 'Define Package Version'
env:
majorVersion: $(MajorVersion)
minorVersion: $(MinorVersion)
patch: $(Patch)
- task: DotNetCoreCLI@2
displayName: 'dotnet pack release'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
command: pack
projects: '**/*.csproj'
includesymbols: true
packDirectory: $(Build.ArtifactStagingDirectory)
verbosityPack: 'minimal'
versionEnvVar: '$(PackageVersion)'
- task: DotNetCoreCLI@2
displayName: 'dotnet pack pre-release'
condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
command: 'pack'
packagesToPack: '**/*.csproj'
nobuild: true
includesymbols: true
includesource: true
packDirectory: $(Build.ArtifactStagingDirectory)
verbosityPack: 'minimal'
versioningScheme: 'byPrereleaseNumber'
majorVersion: '$(MajorVersion)'
minorVersion: '$(MinorVersion)'
patchVersion: '$(Patch)'
- task: PublishPipelineArtifact@0
inputs:
artifactName: 'build-assets'
targetPath: '$(Build.ArtifactStagingDirectory)'
- stage: PreRelease
displayName: Publish pre released artifacts
jobs:
- job: Deploy
displayName: Deploy Artifacts to Nuget.org
pool:
vmImage: 'ubuntu-latest'
timeoutInMinutes: 3
steps:
- checkout: none
- task: DownloadPipelineArtifact@1
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'build-assets'
downloadPath: '$(System.ArtifactsDirectory)'
- task: NuGetCommand@2
displayName: 'push nuget'
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'MyGet'
- stage: Release
displayName: Publish released artifacts
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
jobs:
- job: Deploy
displayName: Deploy Artifacts to Nuget.org
pool:
vmImage: 'ubuntu-latest'
timeoutInMinutes: 3
steps:
- checkout: none
- task: DownloadPipelineArtifact@1
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'build-assets'
downloadPath: '$(System.ArtifactsDirectory)'
- task: NuGetCommand@2
displayName: 'push nuget'
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'Nuget'