@@ -132,163 +132,20 @@ jobs:
132
132
Verbose : ${{ inputs.Verbose }}
133
133
Version : ${{ inputs.Version }}
134
134
135
- BuildDocs :
136
- name : Build docs
135
+ Build-Docs :
137
136
needs :
138
137
- Build-Module
139
- runs-on : ubuntu-latest
140
- steps :
141
- - name : Checkout Code
142
- uses : actions/checkout@v4
143
- with :
144
- fetch-depth : 0
145
-
146
- - name : Debug
147
- if : ${{ inputs.Debug }}
148
- uses : PSModule/Debug@v0
149
-
150
- - name : Initialize environment
151
- uses : PSModule/Initialize-PSModule@v1
152
- with :
153
- Debug : ${{ inputs.Debug }}
154
- Prerelease : ${{ inputs.Prerelease }}
155
- Verbose : ${{ inputs.Verbose }}
156
- Version : ${{ inputs.Version }}
157
-
158
- - name : Document module
159
- uses : PSModule/Document-PSModule@v0
160
- with :
161
- Name : ${{ inputs.Name }}
162
- Path : ${{ inputs.Path }}
163
- ModulesOutputPath : ${{ inputs.ModulesOutputPath }}
164
- DocsOutputPath : ${{ inputs.DocsOutputPath }}
165
- Debug : ${{ inputs.Debug }}
166
- Prerelease : ${{ inputs.Prerelease }}
167
- Verbose : ${{ inputs.Verbose }}
168
- Version : ${{ inputs.Version }}
169
-
170
- - name : Commit all changes
171
- continue-on-error : true
172
- shell : pwsh
173
- run : |
174
- # Rename the gitignore file to .gitignore.bak
175
- Rename-Item -Path '.gitignore' -NewName '.gitignore.bak' -Force
176
-
177
- try {
178
- # Add all changes to the repository
179
- git add .
180
- git commit -m 'Update documentation'
181
- } catch {
182
- Write-Host "No changes to commit"
183
- }
184
-
185
- # Restore the gitignore file
186
- Rename-Item -Path '.gitignore.bak' -NewName '.gitignore' -Force
187
-
188
- - name : Lint documentation
189
- uses : super-linter/super-linter/slim@latest
190
- env :
191
- FILTER_REGEX_INCLUDE : ' ${{ inputs.DocsOutputPath }}/**'
192
- DEFAULT_BRANCH : main
193
- DEFAULT_WORKSPACE : ${{ github.workspace }}
194
- ENABLE_GITHUB_ACTIONS_GROUP_TITLE : true
195
- GITHUB_TOKEN : ${{ github.token }}
196
- RUN_LOCAL : true
197
- VALIDATE_ALL_CODEBASE : true
198
- VALIDATE_JSON_PRETTIER : false
199
- VALIDATE_MARKDOWN_PRETTIER : false
200
- VALIDATE_YAML_PRETTIER : false
201
- VALIDATE_GITLEAKS : false
202
-
203
- - uses : actions/configure-pages@v5
204
-
205
- - name : Install mkdoks-material
206
- shell : pwsh
207
- run : |
208
- pip install mkdocs-material
209
- pip install mkdocs-git-authors-plugin
210
- pip install mkdocs-git-revision-date-localized-plugin
211
- pip install mkdocs-git-committers-plugin-2
212
-
213
- - name : Structure site
214
- uses : PSModule/GitHub-Script@v1
215
- with :
216
- Debug : ${{ inputs.Debug }}
217
- Prerelease : ${{ inputs.Prerelease }}
218
- Verbose : ${{ inputs.Verbose }}
219
- Version : ${{ inputs.Version }}
220
- Script : |
221
- New-Item -Path "$env:GITHUB_WORKSPACE/${{ inputs.SiteOutputPath }}/docs/Functions" -ItemType Directory -Force
222
- Copy-Item -Path "$env:GITHUB_WORKSPACE/${{ inputs.DocsOutputPath }}/*" -Destination "$env:GITHUB_WORKSPACE/${{ inputs.SiteOutputPath }}/docs/Functions" -Recurse -Force
223
- $moduleName = [string]::IsNullOrEmpty('${{ inputs.Name }}') ? $env:GITHUB_REPOSITORY_NAME : '${{ inputs.Name }}'
224
- $ModuleSourcePath = Join-Path $PWD -ChildPath '${{ inputs.Path }}'
225
- $SiteOutputPath = Join-Path $PWD -ChildPath '${{ inputs.SiteOutputPath }}'
226
-
227
- LogGroup "Get folderstructure" {
228
- Get-ChildItem -Recurse | Select-Object -ExpandProperty FullName | Sort-Object
229
- }
230
-
231
- $functionDocsFolder = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Functions' | Get-Item
232
- Get-ChildItem -Path $functionDocsFolder -Recurse -Force -Include '*.md' | ForEach-Object {
233
- $fileName = $_.Name
234
- $hash = (Get-FileHash -Path $_.FullName -Algorithm SHA256).Hash
235
- LogGroup " - [$fileName] - [$hash]" {
236
- Show-FileContent -Path $_
237
- }
238
- }
239
-
240
- LogGroup 'Build docs - Process about topics' {
241
- $aboutDocsFolderPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/About'
242
- $aboutDocsFolder = New-Item -Path $aboutDocsFolderPath -ItemType Directory -Force
243
- $aboutSourceFolder = Get-ChildItem -Path $ModuleSourcePath -Directory | Where-Object { $_.Name -eq 'en-US' }
244
- Get-ChildItem -Path $aboutSourceFolder -Filter *.txt | Copy-Item -Destination $aboutDocsFolder -Force -Verbose -PassThru |
245
- Rename-Item -NewName { $_.Name -replace '.txt', '.md' }
246
- }
247
-
248
- LogGroup 'Build docs - Copy icon to assets' {
249
- $assetsFolderPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Assets'
250
- $null = New-Item -Path $assetsFolderPath -ItemType Directory -Force
251
- $rootPath = Split-Path -Path $ModuleSourcePath -Parent
252
- $iconPath = Join-Path -Path $rootPath -ChildPath 'icon\icon.png'
253
- Copy-Item -Path $iconPath -Destination $assetsFolderPath -Force -Verbose
254
- }
255
-
256
- LogGroup 'Build docs - Copy readme.md' {
257
- $rootPath = Split-Path -Path $ModuleSourcePath -Parent
258
- $readmePath = Join-Path -Path $rootPath -ChildPath 'README.md'
259
- $readmeTargetPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/README.md'
260
- Copy-Item -Path $readmePath -Destination $readmeTargetPath -Force -Verbose
261
- }
262
-
263
- LogGroup 'Build docs - Create mkdocs.yml' {
264
- $rootPath = Split-Path -Path $ModuleSourcePath -Parent
265
- # This should be moved to an action so that we can use a default one, and not have to copy it from the repo.
266
- $mkdocsSourcePath = Join-Path -Path $rootPath -ChildPath 'mkdocs.yml'
267
- $mkdocsTargetPath = Join-Path -Path $SiteOutputPath -ChildPath 'mkdocs.yml'
268
- $mkdocsContent = Get-Content -Path $mkdocsSourcePath -Raw
269
- $mkdocsContent = $mkdocsContent.Replace('-{{ REPO_NAME }}-', $ModuleName)
270
- $mkdocsContent = $mkdocsContent.Replace('-{{ REPO_OWNER }}-', $env:GITHUB_REPOSITORY_OWNER)
271
- $mkdocsContent | Set-Content -Path $mkdocsTargetPath -Force
272
- Show-FileContent -Path $mkdocsTargetPath
273
- }
274
-
275
- - name : Debug File system
276
- shell : pwsh
277
- run : |
278
- Get-ChildItem -Path $env:GITHUB_WORKSPACE -Recurse | Select-Object -ExpandProperty FullName | Sort-Object
279
-
280
- - name : Build mkdocs-material project
281
- working-directory : ${{ inputs.SiteOutputPath }}
282
- shell : pwsh
283
- run : |
284
- Start-LogGroup 'Build docs - mkdocs build - content'
285
- Show-FileContent -Path mkdocs.yml
286
- Stop-LogGroup
287
- Start-LogGroup 'Build docs - mkdocs build'
288
- mkdocs build --config-file mkdocs.yml --site-dir ${{ github.workspace }}/_site
289
- Stop-LogGroup
290
-
291
- - uses : actions/upload-pages-artifact@v3
138
+ uses : ./.github/workflows/Build-Docs.yml
139
+ with :
140
+ Name : ${{ inputs.Name }}
141
+ Path : ${{ inputs.Path }}
142
+ ModulesOutputPath : ${{ inputs.ModulesOutputPath }}
143
+ DocsOutputPath : ${{ inputs.DocsOutputPath }}
144
+ Debug : ${{ inputs.Debug }}
145
+ Prerelease : ${{ inputs.Prerelease }}
146
+ Verbose : ${{ inputs.Verbose }}
147
+ Version : ${{ inputs.Version }}
148
+ SiteOutputPath : ${{ inputs.SiteOutputPath }}
292
149
293
150
# This is necessary as there is no way to get output from a matrix job
294
151
TestModule-pwsh-ubuntu-latest :
0 commit comments