-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnuget-buildinfo-generator.yml
60 lines (48 loc) · 1.38 KB
/
nuget-buildinfo-generator.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
trigger:
- main
variables:
project: './BuildInfo.Generator.csproj'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
targetVersion: yy.M.$(build.buildId)
pool:
vmImage: 'windows-latest'
pr: none
steps:
- checkout: self
submodules: false
fetchDepth: 10
- task: NuGetToolInstaller@1
- task: PowerShell@2
displayName: 'Create CalVer Version'
inputs:
targetType: 'inline'
script: |
$dottedDate = (Get-Date).ToString("yy.M")
$buildID = $($env:BUILD_BUILDID)
$newTargetVersion = "$dottedDate.$buildID"
Write-Host "##vso[task.setvariable variable=targetVersion;]$newTargetVersion"
Write-Host "Updated targetVersion to '$newTargetVersion'"
- task: UseDotNet@2
displayName: 'Use .NET 7.0 SDK'
inputs:
packageType: sdk
version: 7.x
includePreviewVersions: false
installationPath: $(Agent.ToolsDirectory)/dotnet
- task: DotNetCoreCLI@2
displayName: 'restore nuget'
inputs:
command: 'restore'
projects: '$(project)'
- task: CmdLine@2
displayName: 'build'
inputs:
script: 'dotnet build $(project) -c $(buildConfiguration) /p:Version=$(targetVersion) /p:GeneratePackageOnBuild=true'
- task: NuGetCommand@2
displayName: 'push nuget'
inputs:
command: 'push'
packagesToPush: '**/BuildInfo.Generator.$(targetVersion).nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'nuget-curiosity-org'