-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbeta-pipeline.yaml
More file actions
125 lines (108 loc) · 3.52 KB
/
Copy pathbeta-pipeline.yaml
File metadata and controls
125 lines (108 loc) · 3.52 KB
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
# NpgsqlAnalyzers beta releases pipeline
# This pipeline is triggered for the /master branch and creates beta releases.
# The package built in this pipeline is pushed to the local Azure DevOps package feed.
name: 'Beta releases'
resources:
containers:
- container: postgres
image: postgres
ports:
- 5432:5432
env:
POSTGRES_DB: 'postgres'
POSTGRES_USER: 'postgres'
POSTGRES_PASSWORD: 'postgres'
services:
postgres: postgres
variables:
SrcDir: '$(Build.SourcesDirectory)/src'
BuildDir: '$(Build.BinariesDirectory)/publish'
PackDir: '$(Build.BinariesDirectory)/pack'
RepackDir: '$(Build.BinariesDirectory)/repack'
PackageOutputDir: '$(Agent.ArtifactStagingDirectory)'
VersionFilePath: '$(Build.SourcesDirectory)/build/version.txt'
TargetBuildVersion: '0.0.0'
trigger: none
pr: none
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NuGetCommand@2
displayName: 'Restore packages'
inputs:
command: 'restore'
restoreSolution: '$(SrcDir)/NpgsqlAnalyzers.sln'
feedsToUse: 'select'
- task: PowerShell@2
displayName: 'Set build version'
inputs:
targetType: 'inline'
script: |
if (!(Test-Path -Path '$(VersionFilePath)' -PathType Leaf)) {
Write-Error "Version file not found in path '$(VersionFilePath)'"
return
}
$version = (Get-Content -Path '$(VersionFilePath)') + "-beta-" + $(Build.BuildId)
Write-Host "##vso[task.setvariable variable=TargetBuildVersion]$version"
Write-Host "TargetBuildVersion set to $version"
- script: >
dotnet publish
--configuration Release
--output '$(BuildDir)'
-p:version=$(TargetBuildVersion)
'$(SrcDir)/NpgsqlAnalyzers/NpgsqlAnalyzers.csproj'
displayName: 'Build solution'
- script: >
dotnet test
--configuration Release
'$(SrcDir)/NpgsqlAnalyzers.sln'
displayName: 'Run tests'
- script: >
dotnet pack
--configuration Release
--output '$(PackDir)'
-p:version=$(TargetBuildVersion)
'$(SrcDir)/NpgsqlAnalyzers/NpgsqlAnalyzers.csproj'
displayName: 'Create initial package'
- task: ExtractFiles@1
displayName: 'Extract package'
inputs:
archiveFilePatterns: '$(PackDir)/*.nupkg'
destinationFolder: '$(RepackDir)/'
cleanDestinationFolder: true
- task: CopyFiles@2
displayName: 'Copy dependency binaries into package/lib'
inputs:
SourceFolder: '$(BuildDir)'
Contents: '**'
TargetFolder: '$(RepackDir)/lib/netstandard2.0/'
CleanTargetFolder: true
- task: CopyFiles@2
displayName: 'Copy dependancy binaries into package/analyzers/dotnet/cs'
inputs:
SourceFolder: '$(BuildDir)'
Contents: '**'
TargetFolder: '$(RepackDir)/analyzers/dotnet/cs/'
CleanTargetFolder: true
- task: ArchiveFiles@2
displayName: 'Repack package'
inputs:
rootFolderOrFile: '$(RepackDir)'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(PackageOutputDir)/$(TargetBuildVersion).nupkg'
replaceExistingArchive: true
- script: >
dotnet nuget
add source 'https://pkgs.dev.azure.com/ivanstoyanov0768/NpgsqlAnalyzers/_packaging/BetaReleases/nuget/v3/index.json'
--name 'NpgsqlAnalyzersBetaReleasesFeed'
--username 'ivan.stoyanov@esightmonitoring.nl'
--password '$(BetaPackagePublisherToken)'
--store-password-in-clear-text
displayName: 'Add package feed with authentication to source'
- script: >
dotnet nuget push
--source 'NpgsqlAnalyzersBetaReleasesFeed'
--api-key $(BetaPackagePublisherToken)
'$(PackageOutputDir)/*.nupkg'
displayName: 'Publish package to Beta feed'