-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
91 lines (83 loc) · 3.14 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
trigger:
- '*'
-
pool:
# TODO undersök om vilken vm image som ger bäst resultat, windows-2022 eller ubuntu-20.04?
vmImage: 'ubuntu-20.04'
variables:
buildConfiguration: 'Release'
#wwwrootDir: 'NOT_USED_YET'
dotnetSDKVersion: '5.x'
# Används ej än, men kan vara användbar
#solution: '**/*.sln'
WebAppName: 'AzureCloudHue-Harren'
# Den här refererar till Azure Resource Managern som finns här i DevOps under Service Connections
AzureSub: 'Trial Account Subscription'
vmImage: 'ubuntu-20.04'
stages:
- stage: 'Build'
displayName: 'Build WebAPI Application'
jobs:
- job: 'Build'
steps:
- task: UseDotNet@2
displayName: 'Use .NET SDK $(dotnetSDKVersion)'
inputs:
packageType: sdk
version: '$(dotnetSDKVersion)'
- task: DotNetCoreCLI@2
displayName: 'Restore'
inputs:
command: restore
projects: '**/*.csproj'
- task: DotNetCoreCLI@2
displayName: 'Build'
inputs:
command: build
arguments: '--no-restore --configuration Release'
# TODO testprojektet bör väl bara byggas, före bygget av själva API:t?
# projects: 'AzureCloudHueAPI/*.csproj'
projects: '**/*.csproj'
- task: DotNetCoreCLI@2
displayName: 'Publish'
inputs:
command: publish
projects: 'AzureCloudHueAPI/*.csproj'
publishWebProjects: false
# arguments: '--no-build --configuration Release --output $(Build.ArtifactStagingDirectory)/Release'
arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
zipAfterPublish: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
# Denna ska vara given, men lämnar ifall att.
#condition: succeeded()
- stage: 'Deploy'
displayName: 'Deploy to Azure'
dependsOn: Build
jobs:
- deployment: Deploy
pool:
vmImage: $(vmImage)
environment: dev
strategy:
runOnce:
deploy:
steps:
#- download: current
# artifact: drop
- task: DownloadPipelineArtifact@2
inputs:
artifact: 'drop'
targetPath: '$(Pipeline.Workspace)'
#targetPath: '$(Build.ArtifactStagingDirectory)'
- task: AzureWebApp@1
displayName: 'Azure App Service Deploy: website'
inputs:
# TODO change Azure Subscription
azureSubscription: '$(AzureSub)'
resourceGroupName: 'cloud-shell-storage-westeurope'
appType: webApp
appName: '$(WebAppName)'
package: '$(Pipeline.Workspace)/*.zip'
#package: '$(Pipeline.Workspace)/drop/$(buildConfiguration)/*.zip'
#package: '$(Pipeline.Workspace)/drop.zip'