Skip to content
This repository was archived by the owner on May 22, 2024. It is now read-only.

Commit c27a820

Browse files
authored
Enable publishing pre-release versions of package (#82)
1 parent 393b556 commit c27a820

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

GitVersion.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
mode: Mainline
1+
mode: ContinuousDeployment
22
assembly-versioning-scheme: MajorMinorPatch
33
assembly-file-versioning-format: '{Major}.{Minor}.{Patch}.{env:BUILD_BUILDID ?? 0}'
44
assembly-informational-format: '{SemVer}+{ShortSha}'
5+
continuous-delivery-fallback-tag: preview
56
branches:
67
main:
78
regex: ^main$

azure-pipelines.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@ variables:
2020

2121
trigger:
2222
- main
23+
- refs/tags/v*
2324

2425
pool:
25-
vmImage: 'ubuntu-latest'
26+
# Prefer `ubuntu-latest`, but `NuGetKeyVaultSignTool` won't work anymore on Linux (because of dotnet issue https://github.com/dotnet/runtime/issues/48794)
27+
# Also make sure that the proper / or \ is used (according to OS) in the 'Sign' task below
28+
vmImage: 'windows-latest'
2629

2730
stages:
2831
- stage: CI
@@ -79,14 +82,15 @@ stages:
7982
summaryFileLocation: '$(Agent.TempDirectory)/*/coverage.cobertura.xml'
8083

8184
- stage: CD
82-
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
85+
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/tags/')))
8386
jobs:
8487
- job: Release
8588
variables:
8689
SemVer: $[stageDependencies.CI.Build.outputs['Version.GitVersion.SemVer']]
8790
FullSemVer: $[stageDependencies.CI.Build.outputs['Version.GitVersion.FullSemVer']]
8891
NuGetVersion: $[stageDependencies.CI.Build.outputs['Version.GitVersion.NuGetVersion']]
8992
InformationalVersion: $[stageDependencies.CI.Build.outputs['Version.GitVersion.InformationalVersion']]
93+
IsRelease: $[startsWith(variables['Build.SourceBranch'], 'refs/tags/')]
9094
steps:
9195
- task: DotNetCoreCLI@2
9296
displayName: 'Prepare'
@@ -103,7 +107,7 @@ stages:
103107
inputs:
104108
targetType: 'inline'
105109
script: |
106-
.\NuGetKeyVaultSignTool sign $(Pipeline.Workspace)/*.nupkg `
110+
.\NuGetKeyVaultSignTool sign $(Pipeline.Workspace)\*.nupkg `
107111
--file-digest "sha256" `
108112
--timestamp-rfc3161 "http://timestamp.sectigo.com" `
109113
--timestamp-digest "sha256" `
@@ -121,6 +125,30 @@ stages:
121125
publishFeedCredentials: '$(NuGetConnection)'
122126
includeSymbols: true
123127
- task: GitHubRelease@1
128+
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')
129+
displayName: 'Preview'
130+
inputs:
131+
gitHubConnection: '$(GitHubConnection)'
132+
repositoryName: '$(Build.Repository.Name)'
133+
action: 'edit'
134+
target: '$(Build.SourceVersion)'
135+
tagSource: 'userSpecifiedTag'
136+
tag: 'v$(SemVer)'
137+
title: 'v$(FullSemVer)'
138+
assets: '$(Pipeline.Workspace)/*'
139+
releaseNotesSource: 'inline'
140+
releaseNotesInline: |
141+
$(NuGetDescription)
142+
https://www.nuget.org/packages/$(NuGetPackageName)/$(NuGetVersion)
143+
144+
`$(informationalVersion)`
145+
changeLogCompareToRelease: 'lastFullRelease'
146+
changeLogType: 'commitBased'
147+
isDraft: false
148+
# There is no way to set a boolean value except using a condition for the entire task
149+
isPreRelease: true
150+
- task: GitHubRelease@1
151+
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
124152
displayName: 'Release'
125153
inputs:
126154
gitHubConnection: '$(GitHubConnection)'
@@ -140,3 +168,5 @@ stages:
140168
changeLogCompareToRelease: 'lastFullRelease'
141169
changeLogType: 'commitBased'
142170
isDraft: false
171+
# There is no way to set a boolean value except using a condition for the entire task
172+
isPreRelease: false

0 commit comments

Comments
 (0)