Skip to content

Commit 59bff8a

Browse files
authored
Update the release build to create the NuGet package for publish (#1480)
1 parent ebfe4ce commit 59bff8a

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

.vsts-ci/releaseBuild.yml

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,23 @@ jobs:
4242
disableNugetPack: true
4343

4444
- pwsh: |
45+
function Send-VstsCommand ($vstsCommandString) {
46+
Write-Host ("sending: " + $vstsCommandString)
47+
Write-Host "##$vstsCommandString"
48+
}
4549
$(Build.SourcesDirectory)\build.ps1 -Bootstrap
4650
$(Build.SourcesDirectory)\build.ps1 -Configuration Release -Framework net461
4751
# Get module version
4852
$psd1Data = Import-PowerShellDataFile -Path $(Build.SourcesDirectory)\bin\Release\PSReadLine\PSReadLine.psd1
4953
$moduleVersion = $psd1Data.ModuleVersion
5054
$prerelease = $psd1Data.PrivateData.PSData.Prerelease
5155
if ($prerelease) { $moduleVersion = "$moduleVersion-$prerelease" }
52-
$vstsCommandString = "vso[task.setvariable variable=ModuleVersion]$moduleVersion"
53-
Write-Host "sending " + $vstsCommandString
54-
Write-Host "##$vstsCommandString"
56+
Send-VstsCommand "vso[task.setvariable variable=ModuleVersion]$moduleVersion"
5557
# Set target folder paths
56-
$vstsCommandString = "vso[task.setvariable variable=PSReadLine]$(Build.SourcesDirectory)\bin\Release\PSReadLine"
57-
Write-Host "sending " + $vstsCommandString
58-
Write-Host "##$vstsCommandString"
59-
$vstsCommandString = "vso[task.setvariable variable=Signed]$(Build.SourcesDirectory)\bin\Release\Signed"
60-
Write-Host "sending " + $vstsCommandString
61-
Write-Host "##$vstsCommandString"
58+
New-Item -Path $(Build.SourcesDirectory)\bin\Release\NuGetPackage -ItemType Directory > $null
59+
Send-VstsCommand "vso[task.setvariable variable=NuGetPackage]$(Build.SourcesDirectory)\bin\Release\NuGetPackage"
60+
Send-VstsCommand "vso[task.setvariable variable=PSReadLine]$(Build.SourcesDirectory)\bin\Release\PSReadLine"
61+
Send-VstsCommand "vso[task.setvariable variable=Signed]$(Build.SourcesDirectory)\bin\Release\Signed"
6262
displayName: Bootstrap & Build
6363
6464
# Sign the module files
@@ -132,9 +132,21 @@ jobs:
132132
displayName: 'Verify the catalog file'
133133
134134
- pwsh: |
135-
Get-ChildItem -Path $(PSReadLine)
135+
try {
136+
$RepoName = "PSRLLocal"
137+
Register-PSRepository -Name $RepoName -SourceLocation $(NuGetPackage) -PublishLocation $(NuGetPackage) -InstallationPolicy Trusted
138+
Publish-Module -Repository $RepoName -Path $(PSReadLine)
139+
} finally {
140+
Unregister-PSRepository -Name $RepoName -ErrorAction SilentlyContinue
141+
}
142+
Get-ChildItem -Path $(NuGetPackage)
143+
displayName: 'Create the NuGet package'
144+
145+
- pwsh: |
146+
Get-ChildItem -Path $(PSReadLine), $(NuGetPackage)
136147
Write-Host "##vso[artifact.upload containerfolder=PSReadLine;artifactname=PSReadLine]$(PSReadLine)"
137-
displayName: 'Upload module artifacts'
148+
Write-Host "##vso[artifact.upload containerfolder=NuGetPackage;artifactname=NuGetPackage]$(NuGetPackage)"
149+
displayName: 'Upload artifacts'
138150
139151
- template: templates/compliance.yml
140152
parameters:

0 commit comments

Comments
 (0)