Action-Test - [🌟 [Major]: Module version resolution now available as a standalone action #1] by @MariusStorhaug #4
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: | |
| ActionTest-PatchBump: | |
| name: Action-Test - [Patch bump] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Create fake PR event | |
| shell: pwsh | |
| run: | | |
| $event = @{ | |
| pull_request = @{ | |
| head = @{ ref = 'feat/test-patch' } | |
| labels = @( | |
| @{ name = 'patch' } | |
| ) | |
| } | |
| } | ConvertTo-Json -Depth 5 | |
| $event | Set-Content -Path "$env:RUNNER_TEMP/event.json" | |
| "GITHUB_EVENT_PATH=$env:RUNNER_TEMP/event.json" | Out-File -FilePath $env:GITHUB_ENV -Append | |
| - name: Resolve-PSModuleVersion | |
| id: resolve | |
| uses: ./ | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| with: | |
| Settings: | | |
| { | |
| "Publish": { | |
| "Module": { | |
| "ReleaseType": "Release", | |
| "AutoPatching": false, | |
| "VersionPrefix": "v", | |
| "MajorLabels": "major", | |
| "MinorLabels": "minor", | |
| "PatchLabels": "patch", | |
| "IgnoreLabels": "" | |
| } | |
| } | |
| } | |
| - name: Verify - Patch bump | |
| shell: pwsh | |
| env: | |
| RESOLVE_CREATE_RELEASE: ${{ steps.resolve.outputs.CreateRelease }} | |
| RESOLVE_VERSION: ${{ steps.resolve.outputs.Version }} | |
| RESOLVE_RELEASE_TYPE: ${{ steps.resolve.outputs.ReleaseType }} | |
| RESOLVE_FULL_VERSION: ${{ steps.resolve.outputs.FullVersion }} | |
| run: | | |
| $createRelease = $env:RESOLVE_CREATE_RELEASE | |
| $version = $env:RESOLVE_VERSION | |
| $releaseType = $env:RESOLVE_RELEASE_TYPE | |
| $fullVersion = $env:RESOLVE_FULL_VERSION | |
| if ($createRelease -ne 'true') { | |
| Write-Error "Expected CreateRelease='true', got '$createRelease'" | |
| exit 1 | |
| } | |
| if ([string]::IsNullOrEmpty($version)) { | |
| Write-Error 'Expected a non-empty Version' | |
| exit 1 | |
| } | |
| if ($releaseType -ne 'Release') { | |
| Write-Error "Expected ReleaseType='Release', got '$releaseType'" | |
| exit 1 | |
| } | |
| Write-Host "Version: $version" | |
| Write-Host "FullVersion: $fullVersion" | |
| Write-Host "ReleaseType: $releaseType" | |
| Write-Host "CreateRelease: $createRelease" | |
| ActionTest-MinorBump: | |
| name: Action-Test - [Minor bump] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Create fake PR event | |
| shell: pwsh | |
| run: | | |
| $event = @{ | |
| pull_request = @{ | |
| head = @{ ref = 'feat/test-minor' } | |
| labels = @( | |
| @{ name = 'minor' } | |
| ) | |
| } | |
| } | ConvertTo-Json -Depth 5 | |
| $event | Set-Content -Path "$env:RUNNER_TEMP/event.json" | |
| "GITHUB_EVENT_PATH=$env:RUNNER_TEMP/event.json" | Out-File -FilePath $env:GITHUB_ENV -Append | |
| - name: Resolve-PSModuleVersion | |
| id: resolve | |
| uses: ./ | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| with: | |
| Settings: | | |
| { | |
| "Publish": { | |
| "Module": { | |
| "ReleaseType": "Release", | |
| "AutoPatching": false, | |
| "VersionPrefix": "v", | |
| "MajorLabels": "major", | |
| "MinorLabels": "minor", | |
| "PatchLabels": "patch", | |
| "IgnoreLabels": "" | |
| } | |
| } | |
| } | |
| - name: Verify - Minor bump | |
| shell: pwsh | |
| env: | |
| RESOLVE_CREATE_RELEASE: ${{ steps.resolve.outputs.CreateRelease }} | |
| RESOLVE_VERSION: ${{ steps.resolve.outputs.Version }} | |
| RESOLVE_RELEASE_TYPE: ${{ steps.resolve.outputs.ReleaseType }} | |
| RESOLVE_FULL_VERSION: ${{ steps.resolve.outputs.FullVersion }} | |
| run: | | |
| $createRelease = $env:RESOLVE_CREATE_RELEASE | |
| $version = $env:RESOLVE_VERSION | |
| $releaseType = $env:RESOLVE_RELEASE_TYPE | |
| $fullVersion = $env:RESOLVE_FULL_VERSION | |
| if ($createRelease -ne 'true') { | |
| Write-Error "Expected CreateRelease='true', got '$createRelease'" | |
| exit 1 | |
| } | |
| if ([string]::IsNullOrEmpty($version)) { | |
| Write-Error 'Expected a non-empty Version' | |
| exit 1 | |
| } | |
| if ($releaseType -ne 'Release') { | |
| Write-Error "Expected ReleaseType='Release', got '$releaseType'" | |
| exit 1 | |
| } | |
| Write-Host "Version: $version" | |
| Write-Host "FullVersion: $fullVersion" | |
| Write-Host "ReleaseType: $releaseType" | |
| Write-Host "CreateRelease: $createRelease" | |
| ActionTest-MajorBump: | |
| name: Action-Test - [Major bump] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Create fake PR event | |
| shell: pwsh | |
| run: | | |
| $event = @{ | |
| pull_request = @{ | |
| head = @{ ref = 'feat/test-major' } | |
| labels = @( | |
| @{ name = 'major' } | |
| ) | |
| } | |
| } | ConvertTo-Json -Depth 5 | |
| $event | Set-Content -Path "$env:RUNNER_TEMP/event.json" | |
| "GITHUB_EVENT_PATH=$env:RUNNER_TEMP/event.json" | Out-File -FilePath $env:GITHUB_ENV -Append | |
| - name: Resolve-PSModuleVersion | |
| id: resolve | |
| uses: ./ | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| with: | |
| Settings: | | |
| { | |
| "Publish": { | |
| "Module": { | |
| "ReleaseType": "Release", | |
| "AutoPatching": false, | |
| "VersionPrefix": "v", | |
| "MajorLabels": "major", | |
| "MinorLabels": "minor", | |
| "PatchLabels": "patch", | |
| "IgnoreLabels": "" | |
| } | |
| } | |
| } | |
| - name: Verify - Major bump | |
| shell: pwsh | |
| env: | |
| RESOLVE_CREATE_RELEASE: ${{ steps.resolve.outputs.CreateRelease }} | |
| RESOLVE_VERSION: ${{ steps.resolve.outputs.Version }} | |
| RESOLVE_RELEASE_TYPE: ${{ steps.resolve.outputs.ReleaseType }} | |
| RESOLVE_FULL_VERSION: ${{ steps.resolve.outputs.FullVersion }} | |
| run: | | |
| $createRelease = $env:RESOLVE_CREATE_RELEASE | |
| $version = $env:RESOLVE_VERSION | |
| $releaseType = $env:RESOLVE_RELEASE_TYPE | |
| $fullVersion = $env:RESOLVE_FULL_VERSION | |
| if ($createRelease -ne 'true') { | |
| Write-Error "Expected CreateRelease='true', got '$createRelease'" | |
| exit 1 | |
| } | |
| if ([string]::IsNullOrEmpty($version)) { | |
| Write-Error 'Expected a non-empty Version' | |
| exit 1 | |
| } | |
| if ($releaseType -ne 'Release') { | |
| Write-Error "Expected ReleaseType='Release', got '$releaseType'" | |
| exit 1 | |
| } | |
| Write-Host "Version: $version" | |
| Write-Host "FullVersion: $fullVersion" | |
| Write-Host "ReleaseType: $releaseType" | |
| Write-Host "CreateRelease: $createRelease" | |
| ActionTest-AutoPatch: | |
| name: Action-Test - [Auto-patch] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Create fake PR event | |
| shell: pwsh | |
| run: | | |
| $event = @{ | |
| pull_request = @{ | |
| head = @{ ref = 'feat/test-autopatch' } | |
| labels = @() | |
| } | |
| } | ConvertTo-Json -Depth 5 | |
| $event | Set-Content -Path "$env:RUNNER_TEMP/event.json" | |
| "GITHUB_EVENT_PATH=$env:RUNNER_TEMP/event.json" | Out-File -FilePath $env:GITHUB_ENV -Append | |
| - name: Resolve-PSModuleVersion | |
| id: resolve | |
| uses: ./ | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| with: | |
| Settings: | | |
| { | |
| "Publish": { | |
| "Module": { | |
| "ReleaseType": "Release", | |
| "AutoPatching": true, | |
| "VersionPrefix": "v", | |
| "MajorLabels": "major", | |
| "MinorLabels": "minor", | |
| "PatchLabels": "patch", | |
| "IgnoreLabels": "" | |
| } | |
| } | |
| } | |
| - name: Verify - Auto-patch | |
| shell: pwsh | |
| env: | |
| RESOLVE_CREATE_RELEASE: ${{ steps.resolve.outputs.CreateRelease }} | |
| RESOLVE_VERSION: ${{ steps.resolve.outputs.Version }} | |
| RESOLVE_RELEASE_TYPE: ${{ steps.resolve.outputs.ReleaseType }} | |
| RESOLVE_FULL_VERSION: ${{ steps.resolve.outputs.FullVersion }} | |
| run: | | |
| $createRelease = $env:RESOLVE_CREATE_RELEASE | |
| $version = $env:RESOLVE_VERSION | |
| $releaseType = $env:RESOLVE_RELEASE_TYPE | |
| $fullVersion = $env:RESOLVE_FULL_VERSION | |
| if ($createRelease -ne 'true') { | |
| Write-Error "Expected CreateRelease='true', got '$createRelease'" | |
| exit 1 | |
| } | |
| if ([string]::IsNullOrEmpty($version)) { | |
| Write-Error 'Expected a non-empty Version' | |
| exit 1 | |
| } | |
| if ($releaseType -ne 'Release') { | |
| Write-Error "Expected ReleaseType='Release', got '$releaseType'" | |
| exit 1 | |
| } | |
| Write-Host "Version: $version" | |
| Write-Host "FullVersion: $fullVersion" | |
| Write-Host "ReleaseType: $releaseType" | |
| Write-Host "CreateRelease: $createRelease" | |
| ActionTest-IgnoreLabel: | |
| name: Action-Test - [Ignore label] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Create fake PR event | |
| shell: pwsh | |
| run: | | |
| $event = @{ | |
| pull_request = @{ | |
| head = @{ ref = 'feat/test-ignore' } | |
| labels = @( | |
| @{ name = 'patch' } | |
| @{ name = 'skip-release' } | |
| ) | |
| } | |
| } | ConvertTo-Json -Depth 5 | |
| $event | Set-Content -Path "$env:RUNNER_TEMP/event.json" | |
| "GITHUB_EVENT_PATH=$env:RUNNER_TEMP/event.json" | Out-File -FilePath $env:GITHUB_ENV -Append | |
| - name: Resolve-PSModuleVersion | |
| id: resolve | |
| uses: ./ | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| with: | |
| Settings: | | |
| { | |
| "Publish": { | |
| "Module": { | |
| "ReleaseType": "Release", | |
| "AutoPatching": false, | |
| "VersionPrefix": "v", | |
| "MajorLabels": "major", | |
| "MinorLabels": "minor", | |
| "PatchLabels": "patch", | |
| "IgnoreLabels": "skip-release" | |
| } | |
| } | |
| } | |
| - name: Verify - Ignore label | |
| shell: pwsh | |
| env: | |
| RESOLVE_CREATE_RELEASE: ${{ steps.resolve.outputs.CreateRelease }} | |
| RESOLVE_RELEASE_TYPE: ${{ steps.resolve.outputs.ReleaseType }} | |
| run: | | |
| $createRelease = $env:RESOLVE_CREATE_RELEASE | |
| $releaseType = $env:RESOLVE_RELEASE_TYPE | |
| if ($createRelease -ne 'false') { | |
| Write-Error "Expected CreateRelease='false', got '$createRelease'" | |
| exit 1 | |
| } | |
| if ($releaseType -ne 'None') { | |
| Write-Error "Expected ReleaseType='None', got '$releaseType'" | |
| exit 1 | |
| } | |
| Write-Host "ReleaseType: $releaseType" | |
| Write-Host "CreateRelease: $createRelease" | |
| ActionTest-None: | |
| name: Action-Test - [None release type] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Create fake PR event | |
| shell: pwsh | |
| run: | | |
| $event = @{ | |
| pull_request = @{ | |
| head = @{ ref = 'feat/test-none' } | |
| labels = @( | |
| @{ name = 'patch' } | |
| ) | |
| } | |
| } | ConvertTo-Json -Depth 5 | |
| $event | Set-Content -Path "$env:RUNNER_TEMP/event.json" | |
| "GITHUB_EVENT_PATH=$env:RUNNER_TEMP/event.json" | Out-File -FilePath $env:GITHUB_ENV -Append | |
| - name: Resolve-PSModuleVersion | |
| id: resolve | |
| uses: ./ | |
| with: | |
| Settings: | | |
| { | |
| "Publish": { | |
| "Module": { | |
| "ReleaseType": "None", | |
| "AutoPatching": false, | |
| "VersionPrefix": "v", | |
| "MajorLabels": "major", | |
| "MinorLabels": "minor", | |
| "PatchLabels": "patch", | |
| "IgnoreLabels": "" | |
| } | |
| } | |
| } | |
| - name: Verify - None release type | |
| shell: pwsh | |
| env: | |
| RESOLVE_CREATE_RELEASE: ${{ steps.resolve.outputs.CreateRelease }} | |
| RESOLVE_VERSION: ${{ steps.resolve.outputs.Version }} | |
| RESOLVE_RELEASE_TYPE: ${{ steps.resolve.outputs.ReleaseType }} | |
| run: | | |
| $createRelease = $env:RESOLVE_CREATE_RELEASE | |
| $version = $env:RESOLVE_VERSION | |
| $releaseType = $env:RESOLVE_RELEASE_TYPE | |
| if ($createRelease -ne 'false') { | |
| Write-Error "Expected CreateRelease='false', got '$createRelease'" | |
| exit 1 | |
| } | |
| if (-not [string]::IsNullOrEmpty($version)) { | |
| Write-Error "Expected empty Version, got '$version'" | |
| exit 1 | |
| } | |
| if ($releaseType -ne 'None') { | |
| Write-Error "Expected ReleaseType='None', got '$releaseType'" | |
| exit 1 | |
| } | |
| Write-Host "Version: $version" | |
| Write-Host "ReleaseType: $releaseType" | |
| Write-Host "CreateRelease: $createRelease" |