Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PowerShell] better publishing workflow #7114

Merged
merged 2 commits into from
Aug 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ version: 1.0.{build}
image:
- Visual Studio 2017 # PS 5.x
- Ubuntu # PS 6.x
- macOS # PS 6.x
install:
- ps: $PSVersionTable.PSVersion
- ps: Install-Module Pester -Force -Scope CurrentUser
Expand All @@ -15,10 +14,17 @@ test_script:
$host.SetShouldExit($Result.FailedCount)
exit $Result.FailedCount
}
deploy_script:
- ps: |
if ($env:APPVEYOR_REPO_TAG -eq $true -and $env:NuGetApiKey -ne $null)
{
if ($env:APPVEYOR_REPO_TAG -eq $true -and $env:NuGetApiKey -ne $null -and $env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2017") {
.\Build.ps1
choco install NuGet.CommandLine
Install-PackageProvider -Name NuGet -Force
Publish-Module -NuGetApiKey $env:NuGetApiKey -Path .\ -Confirm:$False -Verbose
Publish-Module -NuGetApiKey $env:NuGetApiKey -Path .\src\{{{packageName}}}\ -Confirm:$False -Verbose
if ($LastExitCode -ne 0) {
$host.SetShouldExit($LastExitCode)
exit $LastExitCode
} else {
Write-Host "Published the PowerShell module."
}
}
14 changes: 10 additions & 4 deletions samples/client/petstore/powershell/appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ version: 1.0.{build}
image:
- Visual Studio 2017 # PS 5.x
- Ubuntu # PS 6.x
- macOS # PS 6.x
install:
- ps: $PSVersionTable.PSVersion
- ps: Install-Module Pester -Force -Scope CurrentUser
Expand All @@ -21,10 +20,17 @@ test_script:
$host.SetShouldExit($Result.FailedCount)
exit $Result.FailedCount
}
deploy_script:
- ps: |
if ($env:APPVEYOR_REPO_TAG -eq $true -and $env:NuGetApiKey -ne $null)
{
if ($env:APPVEYOR_REPO_TAG -eq $true -and $env:NuGetApiKey -ne $null -and $env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2017") {
.\Build.ps1
choco install NuGet.CommandLine
Install-PackageProvider -Name NuGet -Force
Publish-Module -NuGetApiKey $env:NuGetApiKey -Path .\ -Confirm:$False -Verbose
Publish-Module -NuGetApiKey $env:NuGetApiKey -Path .\src\PSPetstore\ -Confirm:$False -Verbose
if ($LastExitCode -ne 0) {
$host.SetShouldExit($LastExitCode)
exit $LastExitCode
} else {
Write-Host "Published the PowerShell module."
}
}