Skip to content

Commit 12fbf54

Browse files
Rename Get-Settings workflow to Plan and add Resolve-PSModuleVersion step
1 parent 8bb1745 commit 12fbf54

1 file changed

Lines changed: 119 additions & 0 deletions

File tree

.github/workflows/Plan.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Plan
2+
3+
# The Plan job is the single decision point for the workflow.
4+
# It runs two steps:
5+
# 1. Get-PSModuleSettings - loads and resolves configuration
6+
# 2. Resolve-PSModuleVersion - calculates the next version from settings + PR labels
7+
# All downstream jobs consume the Settings JSON and the resolved version outputs from this job.
8+
9+
on:
10+
workflow_call:
11+
inputs:
12+
SettingsPath:
13+
type: string
14+
description: The path to the settings file.
15+
required: false
16+
Debug:
17+
type: boolean
18+
description: Enable debug output.
19+
required: false
20+
default: false
21+
Verbose:
22+
type: boolean
23+
description: Enable verbose output.
24+
required: false
25+
default: false
26+
Version:
27+
type: string
28+
description: Specifies the version of the GitHub module to be installed. The value must be an exact version.
29+
required: false
30+
default: ''
31+
Prerelease:
32+
type: boolean
33+
description: Whether to use a prerelease version of the 'GitHub' module.
34+
required: false
35+
default: false
36+
WorkingDirectory:
37+
type: string
38+
description: The path to the root of the repo.
39+
required: false
40+
default: '.'
41+
ImportantFilePatterns:
42+
type: string
43+
description: |
44+
Newline-separated list of regex patterns that identify important files.
45+
Changes matching these patterns trigger build, test, and publish stages.
46+
When set, fully replaces the defaults (^src/ and ^README\.md$).
47+
required: false
48+
default: |
49+
^src/
50+
^README\.md$
51+
52+
outputs:
53+
Settings:
54+
description: The complete settings object including test suites.
55+
value: ${{ jobs.Plan.outputs.Settings }}
56+
ModuleVersion:
57+
description: The Major.Minor.Patch part of the next version.
58+
value: ${{ jobs.Plan.outputs.ModuleVersion }}
59+
ModulePrerelease:
60+
description: The prerelease tag, empty string when not a prerelease.
61+
value: ${{ jobs.Plan.outputs.ModulePrerelease }}
62+
ModuleFullVersion:
63+
description: The full version string including prefix and prerelease tag (for example v1.4.0).
64+
value: ${{ jobs.Plan.outputs.ModuleFullVersion }}
65+
ReleaseType:
66+
description: The release type - Release, Prerelease, or None.
67+
value: ${{ jobs.Plan.outputs.ReleaseType }}
68+
CreateRelease:
69+
description: 'true when a release/prerelease should actually be created.'
70+
value: ${{ jobs.Plan.outputs.CreateRelease }}
71+
72+
permissions:
73+
contents: read # to checkout the repo
74+
pull-requests: write # to add labels / comments to PRs
75+
76+
jobs:
77+
Plan:
78+
name: Plan
79+
runs-on: ubuntu-latest
80+
outputs:
81+
Settings: ${{ steps.Get-Settings.outputs.Settings }}
82+
ModuleVersion: ${{ steps.Resolve-Version.outputs.Version }}
83+
ModulePrerelease: ${{ steps.Resolve-Version.outputs.Prerelease }}
84+
ModuleFullVersion: ${{ steps.Resolve-Version.outputs.FullVersion }}
85+
ReleaseType: ${{ steps.Resolve-Version.outputs.ReleaseType }}
86+
CreateRelease: ${{ steps.Resolve-Version.outputs.CreateRelease }}
87+
steps:
88+
- name: Checkout Code
89+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
90+
with:
91+
persist-credentials: false
92+
fetch-depth: 0
93+
94+
- name: Get-Settings
95+
uses: PSModule/Get-PSModuleSettings@1e3d156786c56e6fbd839a1ba5ab21ff8858090e # v1.5.0
96+
id: Get-Settings
97+
with:
98+
SettingsPath: ${{ inputs.SettingsPath }}
99+
Debug: ${{ inputs.Debug }}
100+
Prerelease: ${{ inputs.Prerelease }}
101+
Verbose: ${{ inputs.Verbose }}
102+
Version: ${{ inputs.Version }}
103+
WorkingDirectory: ${{ inputs.WorkingDirectory }}
104+
ImportantFilePatterns: ${{ inputs.ImportantFilePatterns }}
105+
106+
- name: Resolve-Version
107+
# Resolve only when the workflow is going to create a release/prerelease.
108+
if: fromJson(steps.Get-Settings.outputs.Settings).Publish.Module.ReleaseType != 'None'
109+
uses: PSModule/Resolve-PSModuleVersion@main
110+
id: Resolve-Version
111+
env:
112+
GH_TOKEN: ${{ github.token }}
113+
with:
114+
Settings: ${{ steps.Get-Settings.outputs.Settings }}
115+
Debug: ${{ inputs.Debug }}
116+
Prerelease: ${{ inputs.Prerelease }}
117+
Verbose: ${{ inputs.Verbose }}
118+
Version: ${{ inputs.Version }}
119+
WorkingDirectory: ${{ inputs.WorkingDirectory }}

0 commit comments

Comments
 (0)