Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
🚀 [Feature]: Plan job decides version before build so tested artifact equals published artifact#342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
🚀 [Feature]: Plan job decides version before build so tested artifact equals published artifact #342
Changes from all commits
12fbf54f62e29f821cd0394616044072d6e7d80faa5dd0c7e0b0b7a37385a29df0f1c487cf09419b27893d17465a0ebb46d5674cf6f4d0ed13e4ce6336fac67d06f075a438a12c8a83afc226cb6c04ced99d2fe2fbf31ecd5ddf98efe12134a692513b6c935dac345cFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -30,8 +30,10 @@ jobs: | ||
| fetch-depth: 0 | ||
| - name: Build module | ||
| uses: PSModule/Build-PSModule@3b368fe7d4cd5872feddfa2ac3dacfb5dfd0ab13 # v4.0.15 | ||
| uses: PSModule/Build-PSModule@672aaa7a91a379c4c6cd14494d03ab5e87e13c52 # v5.0.0 | ||
| with: | ||
| Name: ${{ fromJson(inputs.Settings).Name }} | ||
| Version: ${{ fromJson(inputs.Settings).Module.Version != '' && fromJson(inputs.Settings).Module.Version || '999.0.0' }} | ||
| Prerelease: ${{ fromJson(inputs.Settings).Module.Prerelease }} | ||
MariusStorhaug marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. MariusStorhaug marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| ArtifactName: ${{ inputs.ArtifactName }} | ||
| WorkingDirectory: ${{ fromJson(inputs.Settings).WorkingDirectory }} | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| name: Plan | ||
| # The Plan job is the single decision point for the workflow. | ||
| # It runs two steps: | ||
| # 1. Get-PSModuleSettings - loads and resolves configuration | ||
| # 2. Resolve-PSModuleVersion - calculates the next version from settings + PR labels | ||
| # The resolved version is merged into the Settings object (Settings.Module.*) by the Enrich-Settings step. | ||
| # All downstream jobs receive one self-contained Settings JSON with no separate version outputs. | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| SettingsPath: | ||
| type: string | ||
| description: The path to the settings file. | ||
| required: false | ||
| Debug: | ||
| type: boolean | ||
| description: Enable debug output. | ||
| required: false | ||
| default: false | ||
| Verbose: | ||
| type: boolean | ||
| description: Enable verbose output. | ||
| required: false | ||
| default: false | ||
| Version: | ||
| type: string | ||
| description: Specifies the version of the GitHub module to be installed. The value must be an exact version. | ||
| required: false | ||
| default: '' | ||
| Prerelease: | ||
| type: boolean | ||
| description: Whether to use a prerelease version of the 'GitHub' module. | ||
| required: false | ||
| default: false | ||
| WorkingDirectory: | ||
| type: string | ||
| description: The path to the root of the repo. | ||
| required: false | ||
| default: '.' | ||
| ImportantFilePatterns: | ||
| type: string | ||
| description: | | ||
| Newline-separated list of regex patterns that identify important files. | ||
| Changes matching these patterns trigger build, test, and publish stages. | ||
| When set, fully replaces the defaults (^src/ and ^README\.md$). | ||
| required: false | ||
| default: | | ||
| ^src/ | ||
| ^README\.md$ | ||
| outputs: | ||
| Settings: | ||
| description: The complete settings object including test suites and resolved module version. | ||
| value: ${{ jobs.Plan.outputs.Settings }} | ||
| permissions: | ||
| contents: read # to checkout the repo | ||
| pull-requests: write # to add labels / comments to PRs | ||
| jobs: | ||
| Plan: | ||
| name: Plan | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| Settings: ${{ steps.Enrich-Settings.outputs.Settings }} | ||
MariusStorhaug marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| persist-credentials: false | ||
| fetch-depth: 0 | ||
| - name: Get-Settings | ||
| uses: PSModule/Get-PSModuleSettings@1e3d156786c56e6fbd839a1ba5ab21ff8858090e # v1.5.0 | ||
| id: Get-Settings | ||
| with: | ||
| SettingsPath: ${{ inputs.SettingsPath }} | ||
| Debug: ${{ inputs.Debug }} | ||
| Prerelease: ${{ inputs.Prerelease }} | ||
| Verbose: ${{ inputs.Verbose }} | ||
| Version: ${{ inputs.Version }} | ||
| WorkingDirectory: ${{ inputs.WorkingDirectory }} | ||
| ImportantFilePatterns: ${{ inputs.ImportantFilePatterns }} | ||
| - name: Resolve-Version | ||
| uses: PSModule/Resolve-PSModuleVersion@d53326c7687d20a7949d457fccd71223856b1890 # v1.1.0 | ||
MariusStorhaug marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| id: Resolve-Version | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| with: | ||
MariusStorhaug marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| Settings: ${{ steps.Get-Settings.outputs.Settings }} | ||
| Name: ${{ fromJson(steps.Get-Settings.outputs.Settings).Name }} | ||
MariusStorhaug marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| Debug: ${{ inputs.Debug }} | ||
| Verbose: ${{ inputs.Verbose }} | ||
| WorkingDirectory: ${{ inputs.WorkingDirectory }} | ||
| - name: Enrich-Settings | ||
| # Merge the resolved version into the Settings object so all downstream jobs | ||
| # receive a single, self-contained Settings JSON with no separate version outputs. | ||
| id: Enrich-Settings | ||
| shell: pwsh | ||
| env: | ||
| SETTINGS: ${{ steps.Get-Settings.outputs.Settings }} | ||
| VERSION: ${{ steps.Resolve-Version.outputs.Version }} | ||
| PRERELEASE: ${{ steps.Resolve-Version.outputs.Prerelease }} | ||
| FULL_VERSION: ${{ steps.Resolve-Version.outputs.FullVersion }} | ||
| RELEASE_TYPE: ${{ steps.Resolve-Version.outputs.ReleaseType }} | ||
MariusStorhaug marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| CREATE_RELEASE: ${{ steps.Resolve-Version.outputs.CreateRelease }} | ||
MariusStorhaug marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| run: | | ||
| $settings = $env:SETTINGS | ConvertFrom-Json | ||
| $settings | Add-Member -MemberType NoteProperty -Name Module -Value ([pscustomobject]@{ | ||
| Version = $env:VERSION | ||
| Prerelease = $env:PRERELEASE | ||
| FullVersion = $env:FULL_VERSION | ||
| ReleaseType = if ([string]::IsNullOrEmpty($env:RELEASE_TYPE)) { 'None' } else { $env:RELEASE_TYPE } | ||
| CreateRelease = $env:CREATE_RELEASE -eq 'true' | ||
| }) | ||
| $enriched = $settings | ConvertTo-Json -Depth 10 -Compress | ||
| "Settings=$enriched" >> $env:GITHUB_OUTPUT | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -13,7 +13,7 @@ on: | ||
| required: true | ||
| permissions: | ||
| contents: write # to checkout the repo and create releases | ||
| contents: write # to checkout the repo, create releases, and upload release artifacts | ||
| pull-requests: write # to comment on PRs | ||
| jobs: | ||
| @@ -30,7 +30,7 @@ jobs: | ||
| fetch-depth: 0 | ||
| - name: Publish module | ||
| uses: PSModule/Publish-PSModule@8917aed588dae1bd1aa2873b1caec1c50c20d255 # v2.2.4 | ||
| uses: PSModule/Publish-PSModule@03c0f8b53d0367c85a0f121f98af9b40c817b0e3 # v3.0.0 | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| with: | ||
| @@ -39,15 +39,6 @@ jobs: | ||
| APIKey: ${{ secrets.APIKey }} | ||
MariusStorhaug marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| WhatIf: ${{ github.repository == 'PSModule/Process-PSModule' }} | ||
| AutoCleanup: ${{ fromJson(inputs.Settings).Publish.Module.AutoCleanup }} | ||
| AutoPatching: ${{ fromJson(inputs.Settings).Publish.Module.AutoPatching }} | ||
| DatePrereleaseFormat: ${{ fromJson(inputs.Settings).Publish.Module.DatePrereleaseFormat }} | ||
| IgnoreLabels: ${{ fromJson(inputs.Settings).Publish.Module.IgnoreLabels }} | ||
| ReleaseType: ${{ fromJson(inputs.Settings).Publish.Module.ReleaseType }} | ||
| IncrementalPrerelease: ${{ fromJson(inputs.Settings).Publish.Module.IncrementalPrerelease }} | ||
| MajorLabels: ${{ fromJson(inputs.Settings).Publish.Module.MajorLabels }} | ||
| MinorLabels: ${{ fromJson(inputs.Settings).Publish.Module.MinorLabels }} | ||
| PatchLabels: ${{ fromJson(inputs.Settings).Publish.Module.PatchLabels }} | ||
| VersionPrefix: ${{ fromJson(inputs.Settings).Publish.Module.VersionPrefix }} | ||
| UsePRTitleAsReleaseName: ${{ fromJson(inputs.Settings).Publish.Module.UsePRTitleAsReleaseName }} | ||
| UsePRBodyAsReleaseNotes: ${{ fromJson(inputs.Settings).Publish.Module.UsePRBodyAsReleaseNotes }} | ||
| UsePRTitleAsNotesHeading: ${{ fromJson(inputs.Settings).Publish.Module.UsePRTitleAsNotesHeading }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -32,7 +32,7 @@ jobs: | ||
| path: ${{ fromJson(inputs.Settings).WorkingDirectory }}/outputs/module | ||
| - name: Test-Module | ||
| uses: PSModule/Test-PSModule@8c3337136dc7cf320da39eeb50e776d04bc9ac73 # v3.0.10 | ||
| uses: PSModule/Test-PSModule@25c9cd89954d558360e5917efbd4dea4ca894144 # v3.0.13 | ||
| with: | ||
MariusStorhaug marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| Name: ${{ fromJson(inputs.Settings).Name }} | ||
| Debug: ${{ fromJson(inputs.Settings).Debug }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -50,7 +50,7 @@ jobs: | ||
| path: ${{ fromJson(inputs.Settings).WorkingDirectory }}/outputs/module | ||
| - name: Install-PSModuleHelpers | ||
| uses: PSModule/Install-PSModuleHelpers@ed79b6e3aa8c9cd3d30ab2bf02ea6bd4687b9c74 # v1.0.7 | ||
| uses: PSModule/Install-PSModuleHelpers@68e8ca76be679bfcb7099aed8cffa911c4ab72af # v1.0.8 | ||
MariusStorhaug marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| - name: Import-Module | ||
| id: import-module | ||
| @@ -64,7 +64,7 @@ jobs: | ||
| "path=$path" >> $env:GITHUB_OUTPUT | ||
| - name: Test-ModuleLocal | ||
| uses: PSModule/Invoke-Pester@266d1cf2532f572470b7c4463fa1072f2bfe4455 # v4.2.5 | ||
| uses: PSModule/Invoke-Pester@9cf262a79e7528d5af41c875c35dae91c44d18dd # v4.2.6 | ||
| with: | ||
| Debug: ${{ fromJson(inputs.Settings).Debug }} | ||
| Prerelease: ${{ fromJson(inputs.Settings).Prerelease }} | ||
| @@ -82,4 +82,4 @@ jobs: | ||
| WorkingDirectory: ${{ fromJson(inputs.Settings).WorkingDirectory }} | ||
| Prescript: | # This is to speed up module loading in Pester. | ||
| Install-PSResource -Repository PSGallery -TrustRepository -Name PSCustomObject | ||
| Import-Module -Name '${{ steps.import-module.outputs.name }}' -RequiredVersion 999.0.0 | ||
| Import-Module -Name '${{ steps.import-module.outputs.name }}' -RequiredVersion '${{ fromJson(inputs.Settings).Module.Version }}' | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.