|
56 | 56 | uses: PSModule/Document-PSModule@v1 |
57 | 57 | with: |
58 | 58 | Name: ${{ inputs.Name }} |
59 | | - Debug: ${{ inputs.Debug }} |
60 | | - Prerelease: ${{ inputs.Prerelease }} |
61 | | - Verbose: ${{ inputs.Verbose }} |
62 | | - Version: ${{ inputs.Version }} |
63 | 59 | WorkingDirectory: ${{ inputs.WorkingDirectory }} |
64 | 60 |
|
65 | 61 | - name: Upload docs artifact |
@@ -112,136 +108,3 @@ jobs: |
112 | 108 | VALIDATE_YAML_PRETTIER: false |
113 | 109 | VALIDATE_JSCPD: false |
114 | 110 | VALIDATE_GITLEAKS: false |
115 | | - |
116 | | - - uses: actions/configure-pages@v5 |
117 | | - |
118 | | - - name: Install mkdoks-material |
119 | | - shell: pwsh |
120 | | - run: | |
121 | | - pip install mkdocs-material |
122 | | - pip install mkdocs-git-authors-plugin |
123 | | - pip install mkdocs-git-revision-date-localized-plugin |
124 | | - pip install mkdocs-git-committers-plugin-2 |
125 | | -
|
126 | | - - name: Structure site |
127 | | - uses: PSModule/GitHub-Script@v1 |
128 | | - with: |
129 | | - Debug: ${{ inputs.Debug }} |
130 | | - Prerelease: ${{ inputs.Prerelease }} |
131 | | - Verbose: ${{ inputs.Verbose }} |
132 | | - Version: ${{ inputs.Version }} |
133 | | - WorkingDirectory: ${{ inputs.WorkingDirectory }} |
134 | | - Script: | |
135 | | - LogGroup "Get folder structure" { |
136 | | - $functionDocsFolder = New-Item -Path "outputs/site/docs/Functions" -ItemType Directory -Force |
137 | | - Copy-Item -Path "outputs/docs/*" -Destination "outputs/site/docs/Functions" -Recurse -Force |
138 | | - $moduleName = [string]::IsNullOrEmpty('${{ inputs.Name }}') ? $env:GITHUB_REPOSITORY_NAME : '${{ inputs.Name }}' |
139 | | - $ModuleSourcePath = Resolve-Path 'src' | Select-Object -ExpandProperty Path |
140 | | - $SiteOutputPath = Resolve-Path 'outputs/site' | Select-Object -ExpandProperty Path |
141 | | -
|
142 | | - Write-Host "Function Docs Folder: $functionDocsFolder" |
143 | | - Write-Host "Module Name: $moduleName" |
144 | | - Write-Host "Module Source Path: $ModuleSourcePath" |
145 | | - Write-Host "Site Output Path: $SiteOutputPath" |
146 | | - } |
147 | | -
|
148 | | - LogGroup "Get folder structure" { |
149 | | - Get-ChildItem -Recurse | Select-Object -ExpandProperty FullName | Sort-Object | Format-List |
150 | | - } |
151 | | -
|
152 | | - Get-ChildItem -Path $functionDocsFolder -Recurse -Force -Include '*.md' | ForEach-Object { |
153 | | - $fileName = $_.Name |
154 | | - LogGroup " - $fileName" { |
155 | | - Show-FileContent -Path $_ |
156 | | - } |
157 | | - } |
158 | | -
|
159 | | - LogGroup 'Build docs - Process about topics' { |
160 | | - $aboutDocsFolderPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/About' |
161 | | - $aboutDocsFolder = New-Item -Path $aboutDocsFolderPath -ItemType Directory -Force |
162 | | - $aboutSourceFolder = Get-ChildItem -Path $ModuleSourcePath -Directory | Where-Object { $_.Name -eq 'en-US' } |
163 | | - Get-ChildItem -Path $aboutSourceFolder -Filter *.txt | Copy-Item -Destination $aboutDocsFolder -Force -Verbose -PassThru | |
164 | | - Rename-Item -NewName { $_.Name -replace '.txt', '.md' } |
165 | | -
|
166 | | - Write-Host "About Docs Folder: $aboutDocsFolder" |
167 | | - Write-Host "About Source Folder: $aboutSourceFolder" |
168 | | - } |
169 | | -
|
170 | | - LogGroup 'Build docs - Copy icon to assets' { |
171 | | - $assetsFolderPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Assets' |
172 | | - $assetsFolder = New-Item -Path $assetsFolderPath -ItemType Directory -Force |
173 | | - $rootPath = Split-Path -Path $ModuleSourcePath -Parent |
174 | | - $iconPath = Resolve-Path 'icon\icon.png' | Select-Object -ExpandProperty Path |
175 | | - Copy-Item -Path $iconPath -Destination $assetsFolder -Force -Verbose |
176 | | -
|
177 | | - Write-Host "Assets Folder: $assetsFolder" |
178 | | - Write-Host "Icon Path: $iconPath" |
179 | | - } |
180 | | -
|
181 | | - LogGroup 'Build docs - Copy readme.md' { |
182 | | - $readmePath = Resolve-Path 'README.md' | Select-Object -ExpandProperty Path |
183 | | - $readmeTargetPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/README.md' |
184 | | - Copy-Item -Path $readmePath -Destination $readmeTargetPath -Force -Verbose |
185 | | -
|
186 | | - Write-Host "Readme Path: $readmePath" |
187 | | - Write-Host "Readme Target Path: $readmeTargetPath" |
188 | | - } |
189 | | -
|
190 | | - LogGroup 'Build docs - Create mkdocs.yml' { |
191 | | - $rootPath = Split-Path -Path $ModuleSourcePath -Parent |
192 | | - $possiblePaths = @( |
193 | | - '.github/mkdocs.yml', |
194 | | - 'docs/mkdocs.yml', |
195 | | - 'mkdocs.yml' |
196 | | - ) |
197 | | -
|
198 | | - $mkdocsSourcePath = $null |
199 | | - foreach ($path in $possiblePaths) { |
200 | | - $candidatePath = Join-Path -Path $rootPath -ChildPath $path |
201 | | - if (Test-Path -Path $candidatePath) { |
202 | | - $mkdocsSourcePath = $candidatePath |
203 | | - break |
204 | | - } |
205 | | - } |
206 | | -
|
207 | | - if (-not $mkdocsSourcePath) { |
208 | | - throw "Mkdocs source file not found in any of the expected locations: $($possiblePaths -join ', ')" |
209 | | - } |
210 | | -
|
211 | | - $mkdocsTargetPath = Join-Path -Path $SiteOutputPath -ChildPath 'mkdocs.yml' |
212 | | -
|
213 | | - Write-Host "Mkdocs Source Path: $mkdocsSourcePath" |
214 | | - Write-Host "Mkdocs Target Path: $mkdocsTargetPath" |
215 | | -
|
216 | | - $mkdocsContent = Get-Content -Path $mkdocsSourcePath -Raw |
217 | | - $mkdocsContent = $mkdocsContent.Replace('-{{ REPO_NAME }}-', $ModuleName) |
218 | | - $mkdocsContent = $mkdocsContent.Replace('-{{ REPO_OWNER }}-', $env:GITHUB_REPOSITORY_OWNER) |
219 | | - $mkdocsContent | Set-Content -Path $mkdocsTargetPath -Force |
220 | | - Show-FileContent -Path $mkdocsTargetPath |
221 | | - } |
222 | | -
|
223 | | - - name: Debug File system |
224 | | - shell: pwsh |
225 | | - working-directory: ${{ inputs.WorkingDirectory }} |
226 | | - run: | |
227 | | - Get-ChildItem -Path . -Recurse | ForEach-Object { |
228 | | - [System.IO.Path]::GetRelativePath($PSScriptRoot, $_.FullName) |
229 | | - } | Sort-Object |
230 | | -
|
231 | | - - name: Build mkdocs-material project |
232 | | - working-directory: ${{ inputs.WorkingDirectory }}/outputs/site |
233 | | - shell: pwsh |
234 | | - run: | |
235 | | - LogGroup 'Build docs - mkdocs build - content' { |
236 | | - Show-FileContent -Path mkdocs.yml |
237 | | - } |
238 | | -
|
239 | | - LogGroup 'Build docs - mkdocs build' { |
240 | | - mkdocs build --config-file mkdocs.yml --site-dir ../../_site |
241 | | - } |
242 | | -
|
243 | | - - uses: actions/upload-pages-artifact@v3 |
244 | | - with: |
245 | | - name: github-pages |
246 | | - path: ${{ inputs.WorkingDirectory }}/_site |
247 | | - retention-days: 1 |
0 commit comments