-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (114 loc) · 4.59 KB
/
Copy pathPlan.yml
File metadata and controls
122 lines (114 loc) · 4.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
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 }}
steps:
- name: Checkout Code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
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@65b7cb026cb3414943778473fd82ee6cf4f0363e # v1.0.1
id: Resolve-Version
env:
GH_TOKEN: ${{ github.token }}
with:
Settings: ${{ steps.Get-Settings.outputs.Settings }}
Debug: ${{ inputs.Debug }}
Prerelease: ${{ inputs.Prerelease }}
Verbose: ${{ inputs.Verbose }}
Version: ${{ inputs.Version }}
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 }}
CREATE_RELEASE: ${{ steps.Resolve-Version.outputs.CreateRelease }}
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