Action-Test - [🌟 [Major]: Version calculation removed — artifact must be pre-stamped before publish #71] by @MariusStorhaug #730
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Action-Test | |
| run-name: "Action-Test - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}" | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| jobs: | |
| ActionTestDefault: | |
| name: Action-Test - [Default] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Upload module artifact | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: module | |
| path: tests/outputs/module | |
| - name: Action-Test | |
| uses: ./ | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| with: | |
| Name: PSModuleTest | |
| WorkingDirectory: tests | |
| APIKey: ${{ secrets.APIKEY }} # zizmor: ignore[secrets-outside-env] saved in org secrets as an intentional choice | |
| WhatIf: true | |
| - name: Validate module version is stamped | |
| shell: pwsh | |
| run: | | |
| $manifestPath = 'tests/outputs/module/PSModuleTest/PSModuleTest.psd1' | |
| $manifest = Import-PowerShellDataFile -Path $manifestPath | |
| $version = $manifest.ModuleVersion | |
| $releaseTag = $env:PSMODULE_PUBLISH_PSMODULE_CONTEXT_ReleaseTag | |
| Write-Host "Module version in manifest: [$version]" | |
| Write-Host "Release tag from action: [$releaseTag]" | |
| if ($version -eq '999.0.0') { | |
| Write-Error "Module version is still the placeholder [999.0.0]. The artifact was not stamped with a real version." | |
| exit 1 | |
| } | |
| if ($releaseTag -match '^999\.0\.0') { | |
| Write-Error "Release tag [$releaseTag] is based on the placeholder version. The artifact was not stamped." | |
| exit 1 | |
| } | |
| Write-Host "Version validation passed: [$version] (tag: [$releaseTag])" |