Public/Test-CCReleaseReady.ps1
|
function Test-CCReleaseReady { <# .SYNOPSIS Checks whether a repository is ready to be released, one row per check. Changes nothing in the working tree. .DESCRIPTION Asks, before a tag exists, everything the release workflow will insist on after one does: release.repository It is a git repository. release.remote What the remote has was fetched (skipped with -NoFetch). release.branch The default branch is checked out. release.clean-tree Nothing is uncommitted. release.in-sync Neither ahead of nor behind the remote. release.latest-tag The latest version tag, which is the current version. release.manifests Every manifest states that version: the last release, never the next. release.targets What the release will publish, as .codecompass/config.yml declares it. A Warning when nothing is declared: Test-CCReleaseOutcome then has nothing to ask after the release. release.changelog-current CHANGELOG.md has an entry for that version. release.changelog-unreleased CHANGELOG.md has work under '## [Unreleased]' to release. A row's Status is Pass, Fail, Warning, Skipped or Info. The repository is ready when no row is Fail. Publish-CCRelease runs these checks itself and stops on a failure. It fetches from the remote unless told not to, so that "in sync" and "the latest tag" are true now and not as of the last fetch. Nothing else is touched. .PARAMETER NoFetch Do not fetch. Compare with what was last known of the remote. .EXAMPLE Test-CCReleaseReady .EXAMPLE Test-CCReleaseReady -Path . | Where-Object Status -EQ 'Fail' #> [CmdletBinding()] [OutputType([pscustomobject])] param( [Parameter(Position = 0)] [string]$Path = '.', [switch]$NoFetch ) $full = (Resolve-Path -LiteralPath $Path).Path $results = [CodeCompass.Core.Releases.ReleaseReadiness]::new().Assess($full, -not $NoFetch) $results | ConvertTo-CCCheckRow } |