Skip to content

Commit 53bdbf4

Browse files
Merge pull request #57 from theohbrothers/docs/usage-improve-and-add-documentation-of-usage-of-the-project
Docs (usage): Improve and add documentation on usage of the project
2 parents 1feaa4f + 1a65e6c commit 53bdbf4

1 file changed

Lines changed: 43 additions & 7 deletions

File tree

README.md

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,26 @@ By default, `PSModulePublisher` uses the main project's root directory as the pa
8989

9090
### Development
9191

92-
The project provides a all-in-one cmdlet [`Invoke-PSModulePublisher`](src/PSModulePublisher/Public/Invoke-PSModulePublisher.ps1) which can be used for executing the same build, test, and publish steps that will run in CI environments.
92+
The project includes the cmdlet [`Invoke-PSModulePublisher`](src/PSModulePublisher/Public/Invoke-PSModulePublisher.ps1) which can be used for executing the project's build, test, and publish steps for PowerShell modules:
9393

94-
### Continuous Integration
94+
```powershell
95+
# Build and Test steps (Generates module manifest, tests module via module manifest)
96+
Invoke-PSModulePublisher
9597
96-
#### Steps
98+
# Publish steps (Publishes module as a dry run)
99+
Invoke-PSModulePublisher -Repository MyPSRepository -DryRun
97100
98-
The CI process is composed of the following steps:
101+
# Publish steps (Publishes module)
102+
Invoke-PSModulePublisher -Repository MyPSRepository
103+
```
104+
105+
### Continuous Integration (CI)
106+
107+
The project includes provided CI templates and cmdlets for executing the project's build, test, and publish steps for PowerShell modules.
108+
109+
#### via Templates
110+
111+
The CI process with the included [CI templates](docs/samples/ci) is composed of the following steps:
99112

100113
##### Build
101114

@@ -115,8 +128,6 @@ The CI process is composed of the following steps:
115128

116129
**Build** and **Test** steps can be executed for every commit pushed. Simply [configure](docs/samples/ci/azure-pipelines/azure-pipelines.linux.sample.yml#L8-L11) your main project's CI file(s) and/or settings to allow so.
117130

118-
#### Publishing the module
119-
120131
**Publish** steps will run only for [*tag* refs](templates/azure-pipelines/steps/pwsh/run-publish.yml#L10). Ensure your main project's CI file(s) and/or settings are [configured](docs/samples/ci/azure-pipelines/azure-pipelines.linux.sample.yml#L5-L7) to run CI jobs for *tag* refs.
121132

122133
Tags must follow [Semantic Versioning](https://semver.org/) and be prepended with a lowercase `v`:
@@ -129,14 +140,39 @@ git tag v1.0.12
129140
git push remotename v1.0.12
130141
```
131142

132-
#### Use cases
143+
##### Use cases
133144

134145
For a basic use case, the CI process could simply comprise a single stage containing all the steps from **Build**, **Test**, and **Publish**.
135146

136147
In cases where the module needs to be tested across multiple operating systems and/or versions of PowerShell, two stages can be configured: The 1st stage containing *multiple jobs* executing [**Build** and **Test** steps](docs/samples/ci/azure-pipelines/azure-pipelines.linux.windows.sample.yml#L24-L40) for building and testing the module; the 2nd stage containing a *single* job executing [**Build** and **Publish** steps](docs/samples/ci/azure-pipelines/azure-pipelines.linux.windows.sample.yml#L52) for publishing the module.
137148

138149
Refer to the [sample CI files](docs/samples/ci) for some working examples.
139150

151+
#### via Cmdlets
152+
153+
##### Parameters
154+
155+
```powershell
156+
Invoke-Build [<CommonParameters>]
157+
Invoke-Test [-ModuleManifestPath] <string> [<CommonParameters>]
158+
Invoke-Publish [-ModuleManifestPath] <string> [-Repository] <string> [-DryRun] [<CommonParameters>]
159+
```
160+
161+
##### Commands
162+
163+
Simply execute the individual cmdlets within your CI environment to perform their respective functions:
164+
165+
```powershell
166+
# Build (Generates module manifest)
167+
$moduleManifestPath = Invoke-Build
168+
169+
# Test (Tests module via module manifest)
170+
Invoke-Test -ModuleManifestPath $moduleManifestPath
171+
172+
# Publish (Publishes module)
173+
Invoke-Publish -ModuleManifestPath $moduleManifestPath -Repository PSGallery
174+
```
175+
140176
### Managing the submodule
141177

142178
#### Retrieving updates

0 commit comments

Comments
 (0)