-
Notifications
You must be signed in to change notification settings - Fork 5
/
azure-pipelines.yml
91 lines (85 loc) · 2.9 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
variables:
majorVersion: '0.1.0'
minorVersion: $[counter('minorVersion', 1)]
servarrVersion: '$(majorVersion).$(minorVersion)'
buildName: '$(Build.SourceBranchName).$(servarrVersion)'
imageName: 'servarr/servarrapi.update'
sentryOrg: 'servarr'
sentryUrl: 'https://sentry.servarr.com'
trigger:
- master
- develop
pr:
- master
- develop
stages:
- stage: Docker
displayName: Build Docker Image
jobs:
- job: Docker
displayName: Build Docker Image
pool:
vmImage: 'Ubuntu-22.04'
steps:
- powershell: Write-Host "##vso[build.updatebuildnumber]$($env:SERVARRVERSION)"
displayName: Set Build Name
- bash: |
sed -i'' -e "s/<AssemblyVersion>[0-9.*]\+<\/AssemblyVersion>/<AssemblyVersion>$SERVARRVERSION<\/AssemblyVersion>/g" src/Directory.Build.props
sed -i'' -e "s/<AssemblyConfiguration>[\$()A-Za-z-]\+<\/AssemblyConfiguration>/<AssemblyConfiguration>${BUILD_SOURCEBRANCHNAME}<\/AssemblyConfiguration>/g" src/Directory.Build.props
- task: Docker@2
displayName: Build image
inputs:
containerRegistry: 'ghcr'
repository: $(imageName)
command: buildAndPush
Dockerfile: Dockerfile
tags: |
latest
$(Build.SourceBranchName)
$(Build.BuildNumber)
- bash: |
echo "Creating sentry release"
curl -sL https://sentry.io/get-cli/ | bash
sentry-cli releases new --finalize -p servarr-update "${SERVARRVERSION}"
sentry-cli releases set-commits --auto "${SERVARRVERSION}"
sentry-cli releases deploys "${SERVARRVERSION}" new -e production
displayName: Create sentry release
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
env:
SENTRY_AUTH_TOKEN: $(sentryAuthTokenServarr)
SENTRY_ORG: $(sentryOrg)
SENTRY_URL: $(sentryUrl)
- stage: Analyze
displayName: Analyze
dependsOn: []
condition: eq(variables['system.pullrequest.isfork'], false)
jobs:
- job: Sonar
displayName: Sonar
pool:
vmImage: windows-2019
steps:
- task: UseDotNet@2
displayName: 'Install .net'
inputs:
version: '6.0.425'
- task: SonarCloudPrepare@1
displayName: 'Prepare SonarCloud'
inputs:
SonarCloud: 'SonarCloud'
organization: 'servarr'
scannerMode: 'MSBuild'
projectKey: 'servarr_ServarrAPI.Update'
projectName: 'ServarrAPI.Update'
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: 'build'
arguments: '-c Release'
projects: 'src/ServarrAPI.sln'
- task: SonarCloudAnalyze@1
displayName: 'SonarCloud Analysis'
- task: SonarCloudPublish@1
displayName: 'Publish SonarCloud to Azure'
inputs:
pollingTimeoutSec: '300'