Add PSGallery publishing support
This commit is contained in:
@@ -24,4 +24,7 @@ Write-Verbose " Folders [$Folders]"
|
|||||||
$Script:TestFile = "$BuildRoot\Output\TestResults_PS$PSVersion`_$TimeStamp.xml"
|
$Script:TestFile = "$BuildRoot\Output\TestResults_PS$PSVersion`_$TimeStamp.xml"
|
||||||
Write-Verbose " TestFile [$TestFile]"
|
Write-Verbose " TestFile [$TestFile]"
|
||||||
|
|
||||||
|
$Script:PSRepository = 'PSGallery'
|
||||||
|
Write-Verbose " PSRepository [$TestFile]"
|
||||||
|
|
||||||
function taskx($Name, $Parameters) { task $Name @Parameters -Source $MyInvocation }
|
function taskx($Name, $Parameters) { task $Name @Parameters -Source $MyInvocation }
|
||||||
|
|||||||
25
BuildTasks/PublishModule.Task.ps1
Normal file
25
BuildTasks/PublishModule.Task.ps1
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
task PublishModule {
|
||||||
|
|
||||||
|
if ( $ENV:BHBuildSystem -ne 'Unknown' -and
|
||||||
|
$ENV:BHBranchName -eq "master" -and
|
||||||
|
[string]::IsNullOrWhiteSpace($ENV:APPVEYOR_PULL_REQUEST_NUMBER) -and
|
||||||
|
-not [string]::IsNullOrWhiteSpace($ENV:NugetApiKey))
|
||||||
|
{
|
||||||
|
$publishModuleSplat = @{
|
||||||
|
Path = $Destination
|
||||||
|
NuGetApiKey = $ENV:NugetApiKey
|
||||||
|
Verbose = $true
|
||||||
|
Force = $true
|
||||||
|
Repository = $PSRepository
|
||||||
|
ErrorAction = 'Stop'
|
||||||
|
}
|
||||||
|
Publish-Module @publishModuleSplat
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
"Skipping deployment: To deploy, ensure that...`n" +
|
||||||
|
"`t* You are in a known build system (Current: $ENV:BHBuildSystem)`n" +
|
||||||
|
"`t* You are committing to the master branch (Current: $ENV:BHBranchName) `n" +
|
||||||
|
"`t* This is not a pull request"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ task Default Build, Test, UpdateSource
|
|||||||
task Build Copy, Compile, BuildModule, BuildManifest, Helpify
|
task Build Copy, Compile, BuildModule, BuildManifest, Helpify
|
||||||
task Helpify GenerateMarkdown, GenerateHelp
|
task Helpify GenerateMarkdown, GenerateHelp
|
||||||
task Test Build, ImportModule, FullTests
|
task Test Build, ImportModule, FullTests
|
||||||
|
task Publish Build, Test, PublishModule
|
||||||
|
|
||||||
Write-Host 'Import common tasks'
|
Write-Host 'Import common tasks'
|
||||||
Get-ChildItem -Path $buildroot\BuildTasks\*.Task.ps1 |
|
Get-ChildItem -Path $buildroot\BuildTasks\*.Task.ps1 |
|
||||||
|
|||||||
@@ -12,8 +12,10 @@ image: Visual Studio 2017
|
|||||||
skip_commits:
|
skip_commits:
|
||||||
message: /updated (readme|doc).*|update (readme|doc).*s/
|
message: /updated (readme|doc).*|update (readme|doc).*s/
|
||||||
|
|
||||||
|
skip_branch_with_pr: true
|
||||||
|
|
||||||
build: false
|
build: false
|
||||||
|
|
||||||
# Kick off the CI/CD pipeline
|
# Kick off the CI/CD pipeline
|
||||||
test_script:
|
build_script:
|
||||||
- ps: . .\build.ps1
|
- ps: . .\build.ps1 Publish
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ Get-PackageProvider -Name 'NuGet' -ForceBootstrap | Out-Null
|
|||||||
Update-LDModule -Name $Script:Modules -Scope $Script:ModuleInstallScope
|
Update-LDModule -Name $Script:Modules -Scope $Script:ModuleInstallScope
|
||||||
|
|
||||||
Set-BuildEnvironment
|
Set-BuildEnvironment
|
||||||
|
Get-ChildItem Env:BH*
|
||||||
|
Get-ChildItem Env:APPVEYOR*
|
||||||
|
|
||||||
$Error.Clear()
|
$Error.Clear()
|
||||||
|
|
||||||
'Invoking build...'
|
'Invoking build...'
|
||||||
|
|||||||
Reference in New Issue
Block a user