/
azure-pipelines.yml
92 lines (80 loc) · 2.45 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:
branches:
include:
- 'main'
variables:
NUKE_TELEMETRY_OPTOUT: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: 1
DOTNET_GENERATE_ASPNET_CERTIFICATE: 0
IS_PULLREQUEST: $[ eq(variables['Build.Reason'], 'PullRequest') ]
IS_MAIN_BRANCH: $[ eq(variables['Build.SourceBranch'], 'refs/heads/main') ]
stages:
- stage: Build
jobs:
- job: Build
steps:
- task: UseDotNet@2
displayName: Ensure latest .NET SDK available
inputs:
packageType: sdk
version: 8.x
- pwsh: |
.\build.ps1 --target Clean Build
displayName: Execute Nuke build
- task: PublishTestResults@2
condition: always()
displayName: Publish Test Results
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '$(Build.SourcesDirectory)/artifacts/TestResults/*.trx'
mergeTestResults: true
- pwsh: |
cd artifacts
mkdir drop
copy *.zip drop
displayName: Prepare artifact drop
- task: PublishPipelineArtifact@1
displayName: Publish artifacts
inputs:
targetPath: './artifacts/drop'
artifact: 'build'
publishLocation: 'pipeline'
- stage: Deploy
condition: |
and(
succeeded(),
eq(variables['IS_MAIN_BRANCH'], true),
eq(variables['IS_PULLREQUEST'], false)
)
jobs:
- deployment: Deploy
environment: jvandertil-blog-prd
strategy:
runOnce:
deploy:
steps:
- download: none
- checkout: self
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: 'build'
targetPath: './artifacts'
- task: UseDotNet@2
displayName: Ensure latest .NET SDK available
inputs:
packageType: sdk
version: 8.x
- task: AzureCLI@2
displayName: 'Run deployment script'
inputs:
azureSubscription: 'sub-jvdtil-quintor (SPN)'
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: |
.\build.ps1 Deploy --environment prd --cloudflare-api-key $env:CLOUDFLARE_API_KEY --cloudflare-zone-id $env:CLOUDFLARE_ZONE_ID
env:
CLOUDFLARE_API_KEY: $(SECRET_CF_API_KEY)
CLOUDFLARE_ZONE_ID: $(SECRET_CF_ZONE_ID)