-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
82 lines (71 loc) · 2.72 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
trigger:
branches:
include:
- master
- main
- feature/*
tags:
include:
- '*'
resources:
repositories:
- repository: recommended_practices
type: github
name: endjin/Endjin.RecommendedPractices.AzureDevopsPipelines.GitHub
endpoint: endjin-github-patfix
jobs:
- job: Build
variables:
NuGetToolVersion: '5.4.0'
pool:
vmImage: 'windows-latest'
steps:
# GitVersion doesn't work on build agenst without the global tools workaround step
- template: templates/install.dotnet-global-tools.workaround.yml@recommended_practices
- template: templates/install-and-run-gitversion.yml@recommended_practices
- powershell: |
Write-Host "##vso[task.setvariable variable=Endjin_IsPreRelease]$((-not ([string]::IsNullOrEmpty($Env:GITVERSION_PRERELEASETAG))))"
Write-Host "##vso[task.setvariable variable=Endjin_Repository_Name]$Env:BUILD_REPOSITORY_NAME"
displayName: 'Set Environment Variables'
- task: NuGetToolInstaller@1
inputs:
versionSpec: '$(NuGetToolVersion)'
- task: PowerShell@2
inputs:
targetType: 'filePath'
filePath: 'src/Endjin.RecommendedPractices.Nuget.Specs/run-tests.ps1'
pwsh: true
displayName: Run tests
- task: NuGetCommand@2
inputs:
command: 'pack'
# Note: this MUST NOT be a wildcard matching all .nuspec files across the entire solution,
# because if we do that, we end up publishing the two test projects (SingleFramework and
# MultiFramework).
packagesToPack: 'src/Endjin.RecommendedPractices.NuGet/**/*.nuspec;src/Endjin.RecommendedPractices.NuGet.GitHub/**/*.nuspec'
versioningScheme: 'byEnvVar'
versionEnvVar: 'GitVersion.SemVer'
- task: PublishBuildArtifacts@1
displayName: 'Publish Release Artifacts'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
- task: GithubRelease@0
displayName: 'Create GitHub Release'
condition: and(succeeded(), or(variables['Endjin.ForcePublish'], eq(variables['GitVersion.PreReleaseTag'], '')))
inputs:
gitHubConnection: $(Endjin_Service_Connection_GitHub)
repositoryName: endjin/Endjin.RecommendedPractices.NuGet
tagSource: manual
tag: $(GitVersion.SemVer)
isPreRelease: $(Endjin_IsPreRelease)
assets: |
$(Build.ArtifactStagingDirectory)/**
- task: NuGetCommand@2
displayName: 'Publish to nuget.org'
condition: and(succeeded(), or(variables['Endjin.ForcePublish'], eq(variables['GitVersion.PreReleaseTag'], '')))
inputs:
command: push
nuGetFeedType: external
publishFeedCredentials: $(Endjin_Service_Connection_NuGet_Org)
versioningScheme: byBuildNumber
packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'