Skip to content

Commit 9d5a073

Browse files
docs(readme): update documentation for clarity and structure, enhancing the setup instructions and workflow overview
1 parent bc61333 commit 9d5a073

File tree

2 files changed

+111
-85
lines changed

2 files changed

+111
-85
lines changed

.github/workflows/workflow.yml

Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -168,45 +168,6 @@ jobs:
168168
Name: ${{ fromJson(needs.Get-Settings.outputs.Settings).Name }}
169169
WorkingDirectory: ${{ inputs.WorkingDirectory }}
170170

171-
# Runs on:
172-
# - ✅ Open/Updated PR - Builds documentation for review
173-
# - ✅ Merged PR - Builds documentation for publishing
174-
# - ❌ Abandoned PR - Skips building docs for abandoned changes
175-
# - ✅ Manual run - Builds documentation when manually triggered
176-
Build-Docs:
177-
if: ${{ !(github.event.action == 'closed' && github.event.pull_request.merged != true) && fromJson(needs.Get-Settings.outputs.Settings).Build.Docs.Skip != true }}
178-
needs:
179-
- Get-Settings
180-
- Build-Module
181-
uses: ./.github/workflows/Build-Docs.yml
182-
with:
183-
Name: ${{ fromJson(needs.Get-Settings.outputs.Settings).Name }}
184-
Debug: ${{ inputs.Debug }}
185-
Prerelease: ${{ inputs.Prerelease }}
186-
Verbose: ${{ inputs.Verbose }}
187-
Version: ${{ inputs.Version }}
188-
WorkingDirectory: ${{ inputs.WorkingDirectory }}
189-
ShowSummaryOnSuccess: ${{ fromJson(needs.Get-Settings.outputs.Settings).Build.Docs.ShowSummaryOnSuccess }}
190-
191-
# Runs on:
192-
# - ✅ Open/Updated PR - Builds site for preview
193-
# - ✅ Merged PR - Builds site for publishing
194-
# - ❌ Abandoned PR - Skips building site for abandoned changes
195-
# - ✅ Manual run - Builds site when manually triggered
196-
Build-Site:
197-
if: ${{ !(github.event.action == 'closed' && github.event.pull_request.merged != true) && fromJson(needs.Get-Settings.outputs.Settings).Build.Site.Skip != true }}
198-
needs:
199-
- Get-Settings
200-
- Build-Docs
201-
uses: ./.github/workflows/Build-Site.yml
202-
with:
203-
Name: ${{ fromJson(needs.Get-Settings.outputs.Settings).Name }}
204-
Debug: ${{ inputs.Debug }}
205-
Prerelease: ${{ inputs.Prerelease }}
206-
Verbose: ${{ inputs.Verbose }}
207-
Version: ${{ inputs.Version }}
208-
WorkingDirectory: ${{ inputs.WorkingDirectory }}
209-
210171
# Runs on:
211172
# - ✅ Open/Updated PR - Tests source code changes
212173
# - ✅ Merged PR - Tests source code before publishing
@@ -453,32 +414,6 @@ jobs:
453414
Verbose: ${{ inputs.Verbose }}
454415
Version: ${{ inputs.Version }}
455416

456-
# Runs on:
457-
# - ❌ Open/Updated PR - Site not published for PRs in progress
458-
# - ✅ Merged PR - Deploys site to GitHub Pages after successful merge
459-
# - ❌ Abandoned PR - Site not published for abandoned changes
460-
# - ❌ Manual run - Only publishes on merged PRs, not manual runs
461-
Publish-Site:
462-
if: ${{ !(github.event.action == 'closed' && github.event.pull_request.merged != true) && needs.Get-TestResults.result == 'success' && needs.Get-CodeCoverage.result == 'success' && needs.Build-Site.result == 'success' && !cancelled() && github.event_name == 'pull_request' && github.event.pull_request.merged == true }}
463-
needs:
464-
- Get-Settings
465-
- Get-TestResults
466-
- Get-CodeCoverage
467-
- Build-Site
468-
permissions:
469-
pages: write # to deploy to Pages
470-
id-token: write # to verify the deployment originates from an appropriate source
471-
environment:
472-
name: github-pages
473-
url: ${{ steps.deployment.outputs.page_url }}
474-
runs-on: ubuntu-latest
475-
steps:
476-
- uses: actions/configure-pages@v5
477-
478-
- name: Deploy to GitHub Pages
479-
id: deployment
480-
uses: actions/deploy-pages@v4
481-
482417
# Runs on:
483418
# - ✅ Open/Updated PR - Publishes prerelease when all tests/coverage/build succeed
484419
# - ✅ Merged PR - Publishes release when all tests/coverage/build succeed
@@ -533,3 +468,68 @@ jobs:
533468
PatchLabels: ${{ fromJson(needs.Get-Settings.outputs.Settings).Publish.Module.PatchLabels }}
534469
VersionPrefix: ${{ fromJson(needs.Get-Settings.outputs.Settings).Publish.Module.VersionPrefix }}
535470
WorkingDirectory: ${{ inputs.WorkingDirectory }}
471+
472+
# Runs on:
473+
# - ✅ Open/Updated PR - Builds documentation for review
474+
# - ✅ Merged PR - Builds documentation for publishing
475+
# - ❌ Abandoned PR - Skips building docs for abandoned changes
476+
# - ✅ Manual run - Builds documentation when manually triggered
477+
Build-Docs:
478+
if: ${{ !(github.event.action == 'closed' && github.event.pull_request.merged != true) && fromJson(needs.Get-Settings.outputs.Settings).Build.Docs.Skip != true }}
479+
needs:
480+
- Get-Settings
481+
- Build-Module
482+
uses: ./.github/workflows/Build-Docs.yml
483+
with:
484+
Name: ${{ fromJson(needs.Get-Settings.outputs.Settings).Name }}
485+
Debug: ${{ inputs.Debug }}
486+
Prerelease: ${{ inputs.Prerelease }}
487+
Verbose: ${{ inputs.Verbose }}
488+
Version: ${{ inputs.Version }}
489+
WorkingDirectory: ${{ inputs.WorkingDirectory }}
490+
ShowSummaryOnSuccess: ${{ fromJson(needs.Get-Settings.outputs.Settings).Build.Docs.ShowSummaryOnSuccess }}
491+
492+
# Runs on:
493+
# - ✅ Open/Updated PR - Builds site for preview
494+
# - ✅ Merged PR - Builds site for publishing
495+
# - ❌ Abandoned PR - Skips building site for abandoned changes
496+
# - ✅ Manual run - Builds site when manually triggered
497+
Build-Site:
498+
if: ${{ !(github.event.action == 'closed' && github.event.pull_request.merged != true) && fromJson(needs.Get-Settings.outputs.Settings).Build.Site.Skip != true }}
499+
needs:
500+
- Get-Settings
501+
- Build-Docs
502+
uses: ./.github/workflows/Build-Site.yml
503+
with:
504+
Name: ${{ fromJson(needs.Get-Settings.outputs.Settings).Name }}
505+
Debug: ${{ inputs.Debug }}
506+
Prerelease: ${{ inputs.Prerelease }}
507+
Verbose: ${{ inputs.Verbose }}
508+
Version: ${{ inputs.Version }}
509+
WorkingDirectory: ${{ inputs.WorkingDirectory }}
510+
511+
# Runs on:
512+
# - ❌ Open/Updated PR - Site not published for PRs in progress
513+
# - ✅ Merged PR - Deploys site to GitHub Pages after successful merge
514+
# - ❌ Abandoned PR - Site not published for abandoned changes
515+
# - ❌ Manual run - Only publishes on merged PRs, not manual runs
516+
Publish-Site:
517+
if: ${{ !(github.event.action == 'closed' && github.event.pull_request.merged != true) && needs.Get-TestResults.result == 'success' && needs.Get-CodeCoverage.result == 'success' && needs.Build-Site.result == 'success' && !cancelled() && github.event_name == 'pull_request' && github.event.pull_request.merged == true }}
518+
needs:
519+
- Get-Settings
520+
- Get-TestResults
521+
- Get-CodeCoverage
522+
- Build-Site
523+
permissions:
524+
pages: write # to deploy to Pages
525+
id-token: write # to verify the deployment originates from an appropriate source
526+
environment:
527+
name: github-pages
528+
url: ${{ steps.deployment.outputs.page_url }}
529+
runs-on: ubuntu-latest
530+
steps:
531+
- uses: actions/configure-pages@v5
532+
533+
- name: Deploy to GitHub Pages
534+
id: deployment
535+
uses: actions/deploy-pages@v4

README.md

Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,46 @@
11
# Process-PSModule
22

3-
Process-PSModule is an end-to-end GitHub Actions workflow that automates the entire lifecycle of a PowerShell module — from build and test to
4-
documentation and publication. It is part of the PSModule framework and provides a unified, standards-based process for developing PowerShell modules
5-
that adhere to consistent testing, linting, and release practices.
6-
7-
The workflow builds the PowerShell module, runs multi-platform tests, enforces code quality and coverage requirements, generates documentation, and
8-
publishes both the module to the PowerShell Gallery and its documentation site to GitHub Pages. It is the core workflow used across all PowerShell
9-
modules in the [PSModule organization](https://github.com/PSModule), ensuring reliable, automated, and maintainable delivery of PowerShell projects.
3+
Process-PSModule is the corner-stone of the PSModule framework. It is an end-to-end GitHub Actions workflow that automates the entire lifecycle of a
4+
PowerShell module. The workflow builds the PowerShell module, runs cross-platform tests, enforces code quality and coverage requirements, generates
5+
documentation, and publishes module to the PowerShell Gallery and its documentation site to GitHub Pages. It is the core workflow used across all
6+
PowerShell modules in the [PSModule organization](https://github.com/PSModule), ensuring reliable, automated, and maintainable delivery of PowerShell
7+
projects.
108

119
## How to get started
1210

1311
1. [Create a repository from the Template-Module](https://github.com/new?template_name=Template-PSModule&template_owner=PSModule&description=Add%20a%20description%20(required)&name=%3CModule%20name%3E).
1412
1. Configure the repository:
1513
1. Enable GitHub Pages in the repository settings. Set it to deploy from **GitHub Actions**.
1614
1. This will create an environment called `github-pages` that GitHub deploys your site to.
17-
<details><summary>Within the **github-pages** environment, remove the branch protection for <code>main</code>.</summary>
18-
<img src="./media/pagesEnvironment.png" alt="Remove the branch protection on main">
19-
</details>
20-
1. [Create an API key on the PowerShell Gallery](https://www.powershellgallery.com/account/apikeys). Give it permission to manage the module you
15+
> [!IMPORTANT]
16+
> Within the **github-pages** environment, remove the branch protection for `main`
17+
> ![Remove the branch protection on main](./media/pagesEnvironment.png)
18+
2. [Create an API key on the PowerShell Gallery](https://www.powershellgallery.com/account/apikeys). Give it permission to manage the module you
2119
are working on.
22-
1. Create a new secret in the repository called `APIKEY` and set it to the API key for the PowerShell Gallery.
23-
1. If you are planning on creating many modules, you could use a glob pattern for the API key permissions and store the secret on the organization.
24-
1. Clone the repo locally, create a branch, make your changes, push the changes, create a PR and let the workflow run.
25-
1. When merging to `main`, the workflow automatically builds, tests, and publishes your module to the PowerShell Gallery and maintains the
20+
3. Create a new secret in the repository called `APIKEY` and set it to the API key for the PowerShell Gallery.
21+
4. If you are planning on creating many modules, you could use a glob pattern for the API key permissions and store the secret on the organization.
22+
2. Clone the repo locally, create a branch, make your changes, push the changes, create a PR and let the workflow run.
23+
3. When merging to `main`, the workflow automatically builds, tests, and publishes your module to the PowerShell Gallery and maintains the
2624
documentation on GitHub Pages. By default the process releases a patch version, which you can change by applying labels like `minor` or `major` on
2725
the PR to bump the version accordingly.
2826

2927
## How it works
3028

29+
Everything is packaged into this single workflow to simplify full configuration of the workflow via this repository. Simplifying management and
30+
operations across all PowerShell module projects. A user can configure how it works by simply configuring settings using a single file.
31+
32+
### Workflow overview
33+
3134
The workflow is designed to be triggered on pull requests to the repository's default branch.
3235
When a pull request is opened, closed, reopened, synchronized (push), or labeled, the workflow will run.
3336
Depending on the labels in the pull requests, the workflow will result in different outcomes.
3437

3538
![Process diagram](./media/Process-PSModule.png)
3639

37-
- [Get settings](./.github/workflows/Get-Settings.yml)
38-
- Reads the settings file from a file in the module repository to configure the workflow.
39-
- Gathers tests and creates test configuration based on the settings and the tests available in the module repository.
40-
- This includes the selection of what OSes to run the tests on.
40+
- [Get settings](#get-settings)
41+
- Reads the settings file `github/PSModule.yml` in the module repository to configure the workflow.
42+
- Gathers context for the process from GitHub and the repo files, configuring what tests to run, if and what kind of release to create, and wether
43+
to setup testing infrastructure and what operating systems to run the tests on.
4144
- [Build module](./.github/workflows/Build-Module.yml)
4245
- Compiles the module source code into a PowerShell module.
4346
- [Test source code](./.github/workflows/Test-SourceCode.yml)
@@ -78,6 +81,10 @@ Depending on the labels in the pull requests, the workflow will result in differ
7881
- Publishes the module to the PowerShell Gallery.
7982
- Creates a release on the GitHub repository.
8083

84+
### Get-Settings
85+
86+
### Lint-Repository
87+
8188
## Usage
8289

8390
To use the workflow, create a new file in the `.github/workflows` directory of the module repository and add the following content.
@@ -453,7 +460,26 @@ This is useful for reviewing what was checked even when no issues are found.
453460

454461
For a complete list of available environment variables and configuration options, see the [super-linter environment variables documentation](https://github.com/super-linter/super-linter#environment-variables).
455462

456-
## Specifications and practices
463+
## Repository structure
464+
465+
Repo highlevel
466+
467+
## Module source code structure
468+
469+
How the module is built.
470+
471+
## Principles and practices
472+
473+
The contribution and release process is based on the idea that a PR is a release, and we only maintain a single linear ancestry of versions, not going
474+
back to patch and update old versions of the modules. This means that if we are on version `2.1.3` of a module and there is a security issue, we only
475+
patch the latest version with a fix, not releasing new versions based on older versions of the module, i.e. not updating the latest 1.x with the
476+
patch.
477+
478+
If you need to work forth a bigger release, create a branch representing the release (a release branch) and open a PR towards `main` for this branch.
479+
For each topic or feature to add to the release, open a new branch representing the feature (a feature branch) and open a PR towards the release
480+
branch. Optionally add the `Prerelease` label on the PR for the release branch, to release preview versions before merging and releasing a published
481+
version of the PowerShell module.
482+
457483

458484
The process is compatible with:
459485

0 commit comments

Comments
 (0)