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

Commit 8128ae8

Browse files
authored
Fix publishing pre-release versions of package (#83)
1 parent c27a820 commit 8128ae8

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

azure-pipelines.yml

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -80,28 +80,28 @@ stages:
8080
inputs:
8181
codeCoverageTool: 'Cobertura'
8282
summaryFileLocation: '$(Agent.TempDirectory)/*/coverage.cobertura.xml'
83-
83+
8484
- stage: CD
85-
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/tags/')))
85+
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')))
8686
jobs:
8787
- job: Release
8888
variables:
8989
SemVer: $[stageDependencies.CI.Build.outputs['Version.GitVersion.SemVer']]
9090
FullSemVer: $[stageDependencies.CI.Build.outputs['Version.GitVersion.FullSemVer']]
9191
NuGetVersion: $[stageDependencies.CI.Build.outputs['Version.GitVersion.NuGetVersion']]
9292
InformationalVersion: $[stageDependencies.CI.Build.outputs['Version.GitVersion.InformationalVersion']]
93-
IsRelease: $[startsWith(variables['Build.SourceBranch'], 'refs/tags/')]
93+
IsPreRelease: $[contains(variables.SemVer, '-')]
9494
steps:
95+
- task: DownloadPipelineArtifact@2
96+
displayName: 'Download'
97+
inputs:
98+
artifactName: '$(ProjectName)'
9599
- task: DotNetCoreCLI@2
96100
displayName: 'Prepare'
97101
inputs:
98102
command: 'custom'
99103
custom: 'tool'
100104
arguments: 'install --tool-path . NuGetKeyVaultSignTool'
101-
- task: DownloadPipelineArtifact@2
102-
displayName: 'Download'
103-
inputs:
104-
artifactName: '$(ProjectName)'
105105
- task: PowerShell@2
106106
displayName: 'Sign'
107107
inputs:
@@ -116,17 +116,9 @@ stages:
116116
--azure-key-vault-client-id "$(azure-key-vault-client-id)" `
117117
--azure-key-vault-client-secret "$(azure-key-vault-client-secret)" `
118118
--azure-key-vault-certificate "$(azure-key-vault-certificate)"
119-
- task: NuGetCommand@2
120-
displayName: 'Push'
121-
inputs:
122-
command: 'push'
123-
packagesToPush: '$(Pipeline.Workspace)/*.nupkg'
124-
nuGetFeedType: 'external'
125-
publishFeedCredentials: '$(NuGetConnection)'
126-
includeSymbols: true
127119
- task: GitHubRelease@1
128120
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')
129-
displayName: 'Preview'
121+
displayName: 'Draft'
130122
inputs:
131123
gitHubConnection: '$(GitHubConnection)'
132124
repositoryName: '$(Build.Repository.Name)'
@@ -139,16 +131,24 @@ stages:
139131
releaseNotesSource: 'inline'
140132
releaseNotesInline: |
141133
$(NuGetDescription)
142-
https://www.nuget.org/packages/$(NuGetPackageName)/$(NuGetVersion)
134+
*(Publish release to push to NuGet)*
143135
144-
`$(informationalVersion)`
136+
`$(InformationalVersion)`
145137
changeLogCompareToRelease: 'lastFullRelease'
146138
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
139+
isDraft: true
140+
isPreRelease: $(IsPreRelease) # ignore vscode warning
141+
- task: NuGetCommand@2
142+
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v')
143+
displayName: 'Push'
144+
inputs:
145+
command: 'push'
146+
packagesToPush: '$(Pipeline.Workspace)/*.nupkg'
147+
nuGetFeedType: 'external'
148+
publishFeedCredentials: '$(NuGetConnection)'
149+
includeSymbols: true
150150
- task: GitHubRelease@1
151-
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
151+
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v')
152152
displayName: 'Release'
153153
inputs:
154154
gitHubConnection: '$(GitHubConnection)'
@@ -162,11 +162,10 @@ stages:
162162
releaseNotesSource: 'inline'
163163
releaseNotesInline: |
164164
$(NuGetDescription)
165-
https://www.nuget.org/packages/$(NuGetPackageName)/$(NuGetVersion)
165+
https://www.nuget.org/packages/$(NuGetPackageName)/$(SemVer)
166166
167-
`$(informationalVersion)`
167+
`$(InformationalVersion)`
168168
changeLogCompareToRelease: 'lastFullRelease'
169169
changeLogType: 'commitBased'
170170
isDraft: false
171-
# There is no way to set a boolean value except using a condition for the entire task
172-
isPreRelease: false
171+
isPreRelease: $(IsPreRelease) # ignore vscode warning

0 commit comments

Comments
 (0)