-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (120 loc) · 4.83 KB
/
Copy pathPlan.yml
File metadata and controls
129 lines (120 loc) · 4.83 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
123
124
125
126
127
128
129
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 publish phase object (Settings.Publish.Module.Resolution.*) 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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
fetch-depth: 0
- name: Checkout Process-PSModule
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
repository: ${{ job.workflow_repository }}
ref: ${{ job.workflow_sha }}
path: _wf
persist-credentials: false
- name: Get-Settings
uses: ./_wf/.github/actions/Get-PSModuleSettings
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: ./_wf/.github/actions/Resolve-PSModuleVersion
id: Resolve-Version
env:
GH_TOKEN: ${{ github.token }}
with:
Settings: ${{ steps.Get-Settings.outputs.Settings }}
Name: ${{ fromJson(steps.Get-Settings.outputs.Settings).Name }}
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 }}
CREATE_RELEASE: ${{ steps.Resolve-Version.outputs.CreateRelease }}
run: |
$settings = $env:SETTINGS | ConvertFrom-Json
$settings.Publish.Module | Add-Member -MemberType NoteProperty -Name Resolution -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'
}) -Force
$enriched = $settings | ConvertTo-Json -Depth 10 -Compress
"Settings=$enriched" >> $env:GITHUB_OUTPUT