Skip to content

Commit 09152da

Browse files
test: add version validation step to prove artifact is not stamped
1 parent 43a6f99 commit 09152da

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

.github/workflows/Action-Test.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,24 @@ jobs:
4141
WorkingDirectory: tests
4242
APIKey: ${{ secrets.APIKEY }} # zizmor: ignore[secrets-outside-env] saved in org secrets as an intentional choice
4343
WhatIf: true
44+
45+
- name: Validate module version is stamped
46+
shell: pwsh
47+
run: |
48+
$manifestPath = 'tests/outputs/module/PSModuleTest/PSModuleTest.psd1'
49+
$manifest = Import-PowerShellDataFile -Path $manifestPath
50+
$version = $manifest.ModuleVersion
51+
$releaseTag = $env:PSMODULE_PUBLISH_PSMODULE_CONTEXT_ReleaseTag
52+
53+
Write-Host "Module version in manifest: [$version]"
54+
Write-Host "Release tag from action: [$releaseTag]"
55+
56+
if ($version -eq '999.0.0') {
57+
Write-Error "Module version is still the placeholder [999.0.0]. The artifact was not stamped with a real version."
58+
exit 1
59+
}
60+
if ($releaseTag -match '^999\.0\.0') {
61+
Write-Error "Release tag [$releaseTag] is based on the placeholder version. The artifact was not stamped."
62+
exit 1
63+
}
64+
Write-Host "Version validation passed: [$version] (tag: [$releaseTag])"

0 commit comments

Comments
 (0)