-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (112 loc) · 4.43 KB
/
Copy pathPlan.yml
File metadata and controls
119 lines (112 loc) · 4.43 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
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
# All downstream jobs consume the Settings JSON and the resolved version outputs from this job.
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.
value: ${{ jobs.Plan.outputs.Settings }}
ModuleVersion:
description: The Major.Minor.Patch part of the next version.
value: ${{ jobs.Plan.outputs.ModuleVersion }}
ModulePrerelease:
description: The prerelease tag, empty string when not a prerelease.
value: ${{ jobs.Plan.outputs.ModulePrerelease }}
ModuleFullVersion:
description: The full version string including prefix and prerelease tag (for example v1.4.0).
value: ${{ jobs.Plan.outputs.ModuleFullVersion }}
ReleaseType:
description: The release type - Release, Prerelease, or None.
value: ${{ jobs.Plan.outputs.ReleaseType }}
CreateRelease:
description: 'true when a release/prerelease should actually be created.'
value: ${{ jobs.Plan.outputs.CreateRelease }}
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.Get-Settings.outputs.Settings }}
ModuleVersion: ${{ steps.Resolve-Version.outputs.Version }}
ModulePrerelease: ${{ steps.Resolve-Version.outputs.Prerelease }}
ModuleFullVersion: ${{ steps.Resolve-Version.outputs.FullVersion }}
ReleaseType: ${{ steps.Resolve-Version.outputs.ReleaseType }}
CreateRelease: ${{ steps.Resolve-Version.outputs.CreateRelease }}
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
# Resolve only when the workflow is going to create a release/prerelease.
if: fromJson(steps.Get-Settings.outputs.Settings).Publish.Module.ReleaseType != 'None'
uses: PSModule/Resolve-PSModuleVersion@main
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 }}