Skip to content
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
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,20 @@

### Fixed

- [**#203**](https://github.com/psake/PowerShellBuild/issues/203)
A publish that fails now fails the build. `Publish-Module` reports a failed
publish as a non-terminating error — an unregistered repository, a rejected
API key, a repository the credential cannot authenticate to — and
`Publish-PSBuildModule` called it at the default preference, so the error was
written to the error stream and the command returned normally. The `Publish`
task in both `psakeFile.ps1` and `IB.tasks.ps1` then reported success for a
module that was never published, which on a release workflow means a green
build and no artifact in the gallery. `Publish-Module` is now called with
`-ErrorAction Stop`, and an explicit `-ErrorAction` passed to
`Publish-PSBuildModule` is forwarded so a consumer who wants the old behavior
can still ask for it. **If your publish has been quietly failing, this is the
release where you find out.**

- [**#201**](https://github.com/psake/PowerShellBuild/issues/201)
`$PSBPreference.Build.CompileModule = $true` now warns when the source
`.psm1` calls `Export-ModuleMember`. Compiling appends the source root
Expand Down Expand Up @@ -264,7 +278,7 @@
that passed before may now correctly fail.
- [**#96**](https://github.com/psake/PowerShellBuild/issues/96)
`Test-PSBuildScriptAnalysis` no longer fails with a path-resolution error
when `SettingsPath` is not supplied. An unsupplied path was forwarded to

Check warning on line 281 in CHANGELOG.md

View workflow job for this annotation

GitHub Actions / CI / Run Linters

Unknown word (unsupplied) Suggestions: (unapplied, unsullied, unspoiled, unstapled, unsupported)
PSScriptAnalyzer as `-Settings ''`, which resolved against the current
directory and threw before any analysis ran, so the function's own
documented example could not run as written.
Expand Down
15 changes: 11 additions & 4 deletions PowerShellBuild/Public/Publish-PSBuildModule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,19 @@ function Publish-PSBuildModule {
Write-Verbose ($LocalizedData.PublishingVersionToRepository -f $Version, $Repository)

$publishParams = @{
Path = $Path
Repository = $Repository
Verbose = $VerbosePreference
Path = $Path
Repository = $Repository
Verbose = $VerbosePreference

# Publish-Module reports a failed publish -- an unregistered repository, a rejected
# API key -- as a non-terminating error. At the default preference the command then
# returns normally, so the Publish task reports success for a module that was never
# published. Stop by default makes the failure reach the task runner; ErrorAction is
# forwarded below so a caller who deliberately wants the softer behavior still gets it.
ErrorAction = 'Stop'
}

'NuGetApiKey', 'Credential' | ForEach-Object {
'NuGetApiKey', 'Credential', 'ErrorAction' | ForEach-Object {
if ($PSBoundParameters.ContainsKey($_)) {
$publishParams.$_ = $PSBoundParameters.$_
}
Expand Down
1 change: 1 addition & 0 deletions instructions/repository-specific.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@
| `Manifest.tests.ps1` | Module manifest validity |
| `Meta.tests.ps1` | Text file formatting across the repository |
| `New-PSBuildFileCatalog.tests.ps1` | Catalog (`.cat`) file creation |
| `Publish-PSBuildModule.tests.ps1` | Publishing to a repository, and failing on a failed publish |
| `Test-PSBuildPester.tests.ps1` | Pester invocation and the Pester version floor |
| `Test-PSBuildScriptAnalysis.tests.ps1` | PSScriptAnalyzer invocation and severity handling |

Expand All @@ -290,7 +291,7 @@

- Triggers: manual dispatch, GitHub release published
- Runs on: `ubuntu-latest`
- Reads `PSGALLERY_API_KEY` secret, converts to `PSCredential`, runs

Check warning on line 294 in instructions/repository-specific.instructions.md

View workflow job for this annotation

GitHub Actions / CI / Run Linters

Unknown word (PSGALLERY) Suggestions: (psaltery, spaller, psaltry, psalter, psalters)
`./build.ps1 -Task Publish -PSGalleryApiKey $cred -Bootstrap`

## Repo-Specific Conventions
Expand Down Expand Up @@ -371,9 +372,9 @@
| ------------------------- | ---------------------------------------------------- |
| `$env:BHProjectPath` | Repository root directory |
| `$env:BHProjectName` | Module name (from directory structure) |
| `$env:BHPSModulePath` | Path to module source directory |

Check warning on line 375 in instructions/repository-specific.instructions.md

View workflow job for this annotation

GitHub Actions / CI / Run Linters

Unknown word (BHPS) Suggestions: (baps, bops, bhp, BHP, bps)
| `$env:BHPSModuleManifest` | Path to `.psd1` manifest |

Check warning on line 376 in instructions/repository-specific.instructions.md

View workflow job for this annotation

GitHub Actions / CI / Run Linters

Unknown word (BHPS) Suggestions: (baps, bops, bhp, BHP, bps)
| `$env:BHModulePath` | Same as `BHPSModulePath` |

Check warning on line 377 in instructions/repository-specific.instructions.md

View workflow job for this annotation

GitHub Actions / CI / Run Linters

Unknown word (BHPS) Suggestions: (baps, bops, bhp, BHP, bps)
| `$env:BHBuildSystem` | Detected CI system (e.g., `GitHubActions`, `Unknown`)|
| `$env:BHBranchName` | Current git branch |
| `$env:BHCommitMessage` | Latest git commit message |
Expand Down
Loading
Loading