diff --git a/modules/openapi-generator/src/main/resources/powershell/appveyor.mustache b/modules/openapi-generator/src/main/resources/powershell/appveyor.mustache index b3ecb9cf594..bf3770e187a 100644 --- a/modules/openapi-generator/src/main/resources/powershell/appveyor.mustache +++ b/modules/openapi-generator/src/main/resources/powershell/appveyor.mustache @@ -1,8 +1,10 @@ {{> partial_header}} version: 1.0.{build} image: - - Visual Studio 2017 # PS 5.x - - Ubuntu # PS 6.x + - Visual Studio 2019 # PS 6.x + #- Visual Studio 2017 # PS 5.x + #- Ubuntu # PS 6.x + # ref: https://www.appveyor.com/docs/build-environment/#build-worker-images install: - ps: $PSVersionTable.PSVersion - ps: Install-Module Pester -Force -Scope CurrentUser @@ -16,13 +18,15 @@ test_script: } deploy_script: - ps: | - if ($env:APPVEYOR_REPO_TAG -eq $true -and $env:NuGetApiKey -ne $null -and $env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2017") { + if ($env:APPVEYOR_REPO_TAG -eq $true -and $env:NuGetApiKey -ne $null -and $env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2019") { .\Build.ps1 - Publish-Module -NuGetApiKey $env:NuGetApiKey -Path .\src\{{{packageName}}}\ -Confirm:$False -Verbose - if ($LastExitCode -ne 0) { + try { + Publish-Module -NuGetApiKey $env:NuGetApiKey -Path .\src\{{{packageName}}}\ -Confirm:$False -Verbose + Write-Host "Successfully published the PowerShell module." + } catch { $host.SetShouldExit($LastExitCode) + Write-Host "Error when running Publish-Module:" + Write-Host $_ exit - } else { - Write-Host "Published the PowerShell module." } } diff --git a/samples/client/petstore/powershell/appveyor.yml b/samples/client/petstore/powershell/appveyor.yml index 8e6678129af..9a8973b0d6e 100644 --- a/samples/client/petstore/powershell/appveyor.yml +++ b/samples/client/petstore/powershell/appveyor.yml @@ -7,8 +7,10 @@ version: 1.0.{build} image: - - Visual Studio 2017 # PS 5.x - - Ubuntu # PS 6.x + - Visual Studio 2019 # PS 6.x + #- Visual Studio 2017 # PS 5.x + #- Ubuntu # PS 6.x + # ref: https://www.appveyor.com/docs/build-environment/#build-worker-images install: - ps: $PSVersionTable.PSVersion - ps: Install-Module Pester -Force -Scope CurrentUser @@ -22,13 +24,15 @@ test_script: } deploy_script: - ps: | - if ($env:APPVEYOR_REPO_TAG -eq $true -and $env:NuGetApiKey -ne $null -and $env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2017") { + if ($env:APPVEYOR_REPO_TAG -eq $true -and $env:NuGetApiKey -ne $null -and $env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2019") { .\Build.ps1 - Publish-Module -NuGetApiKey $env:NuGetApiKey -Path .\src\PSPetstore\ -Confirm:$False -Verbose - if ($LastExitCode -ne 0) { + try { + Publish-Module -NuGetApiKey $env:NuGetApiKey -Path .\src\PSPetstore\ -Confirm:$False -Verbose + Write-Host "Successfully published the PowerShell module." + } catch { $host.SetShouldExit($LastExitCode) + Write-Host "Error when running Publish-Module:" + Write-Host $_ exit - } else { - Write-Host "Published the PowerShell module." } }