Skip to content

Commit

Permalink
Automate publishing the module to the PS Gallery during the build
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuBuisson committed Jul 19, 2017
1 parent 59539b7 commit 06dce8f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions PSCodeHealth.BuildSettings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,6 @@ $Settings = @{
Email = 'MathieuBuisson@users.noreply.github.com'
Name = 'Mathieu Buisson'
ScreenshotPath = "$($env:TEMP)\*Screenshot.png"
PSGalleryKey = $env:PSGallery_Key
OutputModulePath = "$PSScriptRoot\BuildOutput\$($env:APPVEYOR_PROJECT_NAME)"
}
10 changes: 9 additions & 1 deletion PSCodeHealth.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,13 @@ task Copy_Source_To_Build_Output {
Copy-Item -Path $Settings.SourceFolder -Destination $Settings.BuildOutput -Recurse
}

task Publish_Module_To_PSGallery {
Write-TaskBanner -TaskName $Task.Name

Remove-Module -Name 'PSCodeHealth' -Force -ErrorAction SilentlyContinue
Publish-Module -Path $Settings.OutputModulePath -NuGetApiKey $Settings.PSGalleryKey
}

# Default task :
task . Clean,
Install_Dependencies,
Expand All @@ -235,4 +242,5 @@ task . Clean,
Build_Documentation,
Set_Module_Version,
Push_Build_Changes_To_Repo,
Copy_Source_To_Build_Output
Copy_Source_To_Build_Output,
Publish_Module_To_PSGallery
2 changes: 1 addition & 1 deletion PSCodeHealth/PSCodeHealth.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Author = 'Mathieu Buisson'
CompanyName = 'Unknown'

# Copyright statement for this module
Copyright = '(c) 2016 Mathieu Buisson. All rights reserved.'
Copyright = '(c) 2017 Mathieu Buisson. All rights reserved.'

# Description of the functionality provided by this module
Description = 'This module allows you to measure the quality and maintainability of your PowerShell code, based on a variety of metrics.'
Expand Down
2 changes: 2 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ environment:
secure: 0eJvIYA/nSAW0zBTrjkNZ+7s76G3zGM5Oas2iWJicIwjZnRraAbtzrCCb8ndVMhq
GitHub_Key:
secure: wtrwAJK+i7Ar5L8TXeXOUtsxmVD+2wXu9u9bOf6GRfPP0Xn2V4yqTatLwaT7VWA6
PSGallery_Key:
secure: 1OaraGK9SJwOoGVdOHdM1DH5rvfL2AcDfvUFvrMxKYIkqJ0LIw3rwe4nUhxMgBfE

before_build:
- ps: Write-Host "Build version :` $env:APPVEYOR_BUILD_VERSION"
Expand Down

0 comments on commit 06dce8f

Please sign in to comment.