-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathazure-pipelines.yml
151 lines (143 loc) · 5.12 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
# .NET Core Function App to Windows on Azure
# Build a .NET Core function app and deploy it to Azure as a Windows function App.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/dotnet-core
trigger:
- main
pr: none
variables:
# Agent VM image name
vmImageName: 'ubuntu-latest'
# Working Directory
workingDirectory: '$(System.DefaultWorkingDirectory)/'
stages:
- stage: Build
displayName: Build stage
jobs:
- job: Build
displayName: Build
pool:
vmImage: $(vmImageName)
steps:
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: '7.x'
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: '6.x'
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: 'build'
projects: |
$(workingDirectory)/*.sln
arguments: --configuration Release
- task: DotNetCoreCLI@2
displayName: Publish frontend
inputs:
command: 'publish'
projects: $(workingDirectory)/src/CZ.Azure.FileExchange/CZ.Azure.FileExchange.csproj
arguments: --output $(workingDirectory)/fe/ --configuration Release
zipAfterPublish: false
workingDirectory: $(workingDirectory)/src/CZ.Azure.FileExchange/
publishWebProjects: false
- task: DotNetCoreCLI@2
displayName: Publish api
inputs:
command: 'publish'
projects: $(workingDirectory)/src/CZ.Azure.FileExchange.Api/CZ.Azure.FileExchange.Api.csproj
arguments: --output $(workingDirectory)/api --configuration Release --runtime win-x86 --no-self-contained
zipAfterPublish: false
workingDirectory: $(workingDirectory)/src/CZ.Azure.FileExchange.Api/
publishWebProjects: false
- script: 'az bicep build --file $(workingDirectory)/main.bicep --outfile $(Build.ArtifactStagingDirectory)/azuredeploy.json'
displayName: build bicep file
- task: ArchiveFiles@2
displayName: archive fe
inputs:
archiveFile: $(Build.ArtifactStagingDirectory)/Frontend.zip
archiveType: zip
includeRootFolder: false
rootFolderOrFile: $(workingDirectory)/fe/CZ.Azure.FileExchange/wwwroot/
replaceExistingArchive: true
- task: ArchiveFiles@2
displayName: archive api
inputs:
archiveFile: $(Build.ArtifactStagingDirectory)/API.zip
archiveType: zip
includeRootFolder: false
rootFolderOrFile: $(workingDirectory)/api/CZ.Azure.FileExchange.Api/
replaceExistingArchive: true
- task: CopyFiles@2
displayName: "copy deploy script to the artifact bundle"
inputs:
SourceFolder: $(workingDirectory)/build/
Contents: '**.ps1'
TargetFolder: $(Build.ArtifactStagingDirectory)/
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: Container
- stage: ReleaseToGithub
displayName: Release to Github
dependsOn: Build
condition: succeeded()
jobs:
- deployment: DeployGithub
displayName: "Deploy - Github Release"
environment: 'development'
pool:
vmImage: $(vmImageName)
strategy:
runOnce:
deploy:
steps:
- task: GitHubRelease@1
displayName: 'release to github'
inputs:
assets: |
$(Pipeline.Workspace)/drop/*.zip
$(Pipeline.Workspace)/drop/azuredeploy.json
$(Pipeline.Workspace)/drop/deploy.ps1
repositoryName: $(Build.Repository.Name)
assetUploadMode: replace
title: $(Build.BuildNumber)
gitHubConnection: 'push release'
action: create
target: '$(Build.SourceVersion)'
tagSource: userSpecifiedTag
tag: $(Build.BuildNumber)
changeLogCompareToRelease: 'lastFullRelease'
changeLogType: 'commitBased'
- stage: ReleaseToAzure
displayName: Release to Azure
dependsOn:
- Build
- ReleaseToGithub
condition: succeeded()
jobs:
- deployment: DeployAzure
displayName: "Deploy - Azure Environment"
environment: 'development'
pool:
vmImage: $(vmImageName)
strategy:
runOnce:
deploy:
steps:
- task: AzureResourceManagerTemplateDeployment@3
displayName: "Deploy ARM template to Azure"
inputs:
deploymentScope: 'Resource Group'
azureResourceManagerConnection: 'Nutzungsbasierte Bezahlung (current) (be99037d-eba5-4420-a2d3-0812c5dd9c51)'
subscriptionId: 'be99037d-eba5-4420-a2d3-0812c5dd9c51'
action: 'Create Or Update Resource Group'
resourceGroupName: 'pajetestfileshare'
location: 'West Europe'
templateLocation: 'Linked artifact'
csmFile: '$(Pipeline.Workspace)/drop/azuredeploy.json'
overrideParameters: '-name pajetestfileshare'
deploymentMode: 'Incremental'