-
Notifications
You must be signed in to change notification settings - Fork 3
/
azure-pipelines-simple.yml
74 lines (65 loc) · 1.73 KB
/
azure-pipelines-simple.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
trigger:
batch: true
branches:
- master
variables:
- group: "dev"
stages:
- stage: Build
jobs:
- job: Build
variables:
buildConfiguration: 'Release'
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UseDotNet@2
displayName: Install .NET Core 3.1.x SDK
inputs:
packageType: 'sdk'
version: '3.1.x'
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: 'build'
projects: '**/*.csproj'
arguments: '--configuration $(BuildConfiguration)'
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: 'test'
projects: '**/*[Tt]ests/*.csproj'
arguments: '--configuration $(BuildConfiguration) --logger "trx;verbosity=normal"'
publishTestResults: true
- stage: Deploy
dependsOn: Build
jobs:
- job: Deploy
condition: and(succeeded(), in(variables['Build.SourceBranch'], 'refs/heads/master'))
variables:
- name: tag
value: latest
- name: containerRepo
value: 'dev'
- name: containers
value: $(CONTAINER_REGISTRY)/$(IMAGE_REPOSITORY):${{ variables.tag }}
pool:
vmImage: 'ubuntu-latest'
workspace:
clean: all
steps:
- task: Docker@2
displayName: Build and push Docker image
inputs:
command: buildAndPush
repository: $(IMAGE_REPOSITORY)
containerRegistry: $(REGISTRY_CONNECTION)
tags: |
latest
$(Build.SourceVersion)
- task: AzureWebAppContainer@1
displayName: Deploy Docker image to App Service
inputs:
azureSubscription: $(DEV_SERVICE_CONNECTION)
appName: $(IMAGE_REPOSITORY)
containers: ${{ variables.containers }}