-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-prod.yml
86 lines (81 loc) · 2.62 KB
/
build-prod.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
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
resources:
repositories:
- repository: Frontend
type: github
endpoint: Azure Devops OrsoDevOps
name: orso-co/Orso.Arpa.Web
ref: main
trigger:
- main
trigger:
- master
pr: none
pool:
vmImage: 'windows-latest'
variables:
backendWorkingDirectory: '$(AGENT.BUILDDIRECTORY)\Orso.Arpa.Api'
frontendWorkingDirectory: '$(AGENT.BUILDDIRECTORY)\Orso.Arpa.Web'
solution: 'Orso.Arpa.Api\**\*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
frontendOutputPath: '..\a\Orso.Arpa.Api\wwwroot'
stage: 'prod'
targetFramework: '8.0'
steps:
- checkout: self
path: 'Orso.Arpa.Api'
- checkout: Frontend
path: 'Orso.Arpa.Web'
- task: UseDotNet@2
displayName: Use .NET SDK $(targetFramework).x
inputs:
packageType: 'sdk'
version: '$(targetFramework).x'
- task: DotNetCoreCLI@2
displayName: Restore Backend
inputs:
command: restore
projects: '$(backendWorkingDirectory)/**/*.csproj'
- task: DotNetCoreCLI@2
displayName: Build Backend
inputs:
command: build
projects: '$(backendWorkingDirectory)/**/Orso.Arpa.Api.csproj'
arguments: --configuration $(BuildConfiguration) --no-restore
- task: DotNetCoreCLI@2
displayName: Publish Backend
inputs:
command: publish
projects: '$(backendWorkingDirectory)/**/Orso.Arpa.Api.csproj'
publishWebProjects: false
arguments: --configuration $(BuildConfiguration) --output "$(build.artifactstagingdirectory)"
zipAfterPublish: false
- task: NodeTool@0
inputs:
versionSpec: '18.17'
displayName: 'Install Node.js'
- script: npm install --legacy-peer-deps
displayName: 'Install Frontend Dependencies'
workingDirectory: $(frontendWorkingDirectory)
- script: npx ng build --configuration production --output-path $(frontendOutputPath)
displayName: 'Build Frontend'
workingDirectory: $(frontendWorkingDirectory)
- task: ArchiveFiles@2
displayName: Create .zip File
inputs:
rootFolderOrFile: '$(build.artifactstagingdirectory)/Orso.Arpa.Api'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/Orso.Arpa.Api.zip'
replaceExistingArchive: true
verbose: true
- task: PublishBuildArtifacts@1
displayName: Publish Artifact
inputs:
PathtoPublish: $(build.artifactstagingdirectory)/Orso.Arpa.Api.zip
ArtifactName: 'orso-arpa-$(stage)'
TargetPath: '\\my\share\$(Build.DefinitionName)\$(Build.BuildNumber)'