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

Commit

Permalink
Enable publishing pre-release versions of package (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbhoek authored Mar 15, 2022
1 parent 393b556 commit c27a820
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
3 changes: 2 additions & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
mode: Mainline
mode: ContinuousDeployment
assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-format: '{Major}.{Minor}.{Patch}.{env:BUILD_BUILDID ?? 0}'
assembly-informational-format: '{SemVer}+{ShortSha}'
continuous-delivery-fallback-tag: preview
branches:
main:
regex: ^main$
Expand Down
36 changes: 33 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ variables:

trigger:
- main
- refs/tags/v*

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

stages:
- stage: CI
Expand Down Expand Up @@ -79,14 +82,15 @@ stages:
summaryFileLocation: '$(Agent.TempDirectory)/*/coverage.cobertura.xml'

- stage: CD
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/tags/')))
jobs:
- job: Release
variables:
SemVer: $[stageDependencies.CI.Build.outputs['Version.GitVersion.SemVer']]
FullSemVer: $[stageDependencies.CI.Build.outputs['Version.GitVersion.FullSemVer']]
NuGetVersion: $[stageDependencies.CI.Build.outputs['Version.GitVersion.NuGetVersion']]
InformationalVersion: $[stageDependencies.CI.Build.outputs['Version.GitVersion.InformationalVersion']]
IsRelease: $[startsWith(variables['Build.SourceBranch'], 'refs/tags/')]
steps:
- task: DotNetCoreCLI@2
displayName: 'Prepare'
Expand All @@ -103,7 +107,7 @@ stages:
inputs:
targetType: 'inline'
script: |
.\NuGetKeyVaultSignTool sign $(Pipeline.Workspace)/*.nupkg `
.\NuGetKeyVaultSignTool sign $(Pipeline.Workspace)\*.nupkg `
--file-digest "sha256" `
--timestamp-rfc3161 "http://timestamp.sectigo.com" `
--timestamp-digest "sha256" `
Expand All @@ -121,6 +125,30 @@ stages:
publishFeedCredentials: '$(NuGetConnection)'
includeSymbols: true
- task: GitHubRelease@1
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')
displayName: 'Preview'
inputs:
gitHubConnection: '$(GitHubConnection)'
repositoryName: '$(Build.Repository.Name)'
action: 'edit'
target: '$(Build.SourceVersion)'
tagSource: 'userSpecifiedTag'
tag: 'v$(SemVer)'
title: 'v$(FullSemVer)'
assets: '$(Pipeline.Workspace)/*'
releaseNotesSource: 'inline'
releaseNotesInline: |
$(NuGetDescription)
https://www.nuget.org/packages/$(NuGetPackageName)/$(NuGetVersion)
`$(informationalVersion)`
changeLogCompareToRelease: 'lastFullRelease'
changeLogType: 'commitBased'
isDraft: false
# There is no way to set a boolean value except using a condition for the entire task
isPreRelease: true
- task: GitHubRelease@1
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
displayName: 'Release'
inputs:
gitHubConnection: '$(GitHubConnection)'
Expand All @@ -140,3 +168,5 @@ stages:
changeLogCompareToRelease: 'lastFullRelease'
changeLogType: 'commitBased'
isDraft: false
# There is no way to set a boolean value except using a condition for the entire task
isPreRelease: false

0 comments on commit c27a820

Please sign in to comment.