@@ -524,64 +524,66 @@ jobs:
524
524
pip install mkdocs-git-revision-date-localized-plugin
525
525
pip install mkdocs-git-committers-plugin-2
526
526
527
- - name : Run Script
528
- shell : pwsh
529
- run : |
530
- $ModuleName = '${{ inputs.Name }}'
531
-
532
- if (-not $ModuleName) {
533
- $ModuleName = $env:GITHUB_REPOSITORY -replace '.+/'
534
- }
535
- Write-Verbose "Module name: $ModuleName"
536
-
537
- $ModuleSourcePath = Join-Path (Get-Location) -ChildPath '${{ inputs.Path }}'
538
- $DocsOutputPath = Join-Path (Get-Location) -ChildPath "${{ inputs.DocsOutputPath }}/$ModuleName"
539
- $SiteOutputPath = Join-Path (Get-Location) -ChildPath '${{ inputs.SiteOutputPath }}'
540
-
541
- $functionDocsFolderPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Functions'
542
- $functionDocsFolder = New-Item -Path $functionDocsFolderPath -ItemType Directory -Force
543
- Get-ChildItem -Path $DocsOutputPath -Recurse -Force -Include '*.md' | Copy-Item -Destination $functionDocsFolder -Recurse -Force
544
- Get-ChildItem -Path $functionDocsFolder -Recurse -Force -Include '*.md' | ForEach-Object {
545
- $fileName = $_.Name
546
- $hash = (Get-FileHash -Path $_.FullName -Algorithm SHA256).Hash
547
- Start-LogGroup " - [$fileName] - [$hash]"
548
- Show-FileContent -Path $_
549
- Stop-LogGroup
550
- }
551
-
552
- Start-LogGroup 'Build docs - Process about topics'
553
- $aboutDocsFolderPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/About'
554
- $aboutDocsFolder = New-Item -Path $aboutDocsFolderPath -ItemType Directory -Force
555
- $aboutSourceFolder = Get-ChildItem -Path $ModuleSourcePath -Directory | Where-Object { $_.Name -eq 'en-US' }
556
- Get-ChildItem -Path $aboutSourceFolder -Filter *.txt | Copy-Item -Destination $aboutDocsFolder -Force -Verbose -PassThru |
557
- Rename-Item -NewName { $_.Name -replace '.txt', '.md' }
558
- Stop-LogGroup
527
+ - name : Structure site
528
+ uses : PSModule/GitHub-Script@v1
529
+ with :
530
+ Script : |
531
+ $ModuleName = '${{ inputs.Name }}'
559
532
560
- Start-LogGroup 'Build docs - Copy icon to assets'
561
- $assetsFolderPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Assets'
562
- $null = New-Item -Path $assetsFolderPath -ItemType Directory -Force
563
- $rootPath = Split-Path -Path $ModuleSourcePath -Parent
564
- $iconPath = Join-Path -Path $rootPath -ChildPath 'icon\icon.png'
565
- Copy-Item -Path $iconPath -Destination $assetsFolderPath -Force -Verbose
566
-
567
- Start-LogGroup 'Build docs - Copy readme.md'
568
- $rootPath = Split-Path -Path $ModuleSourcePath -Parent
569
- $readmePath = Join-Path -Path $rootPath -ChildPath 'README.md'
570
- $readmeTargetPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/README.md'
571
- Copy-Item -Path $readmePath -Destination $readmeTargetPath -Force -Verbose
572
- Stop-LogGroup
533
+ if (-not $ModuleName) {
534
+ $ModuleName = $env:GITHUB_REPOSITORY -replace '.+/'
535
+ }
536
+ Write-Verbose "Module name: $ModuleName"
537
+
538
+ $ModuleSourcePath = Join-Path (Get-Location) -ChildPath '${{ inputs.Path }}'
539
+ $DocsOutputPath = Join-Path (Get-Location) -ChildPath "${{ inputs.DocsOutputPath }}/$ModuleName"
540
+ $SiteOutputPath = Join-Path (Get-Location) -ChildPath '${{ inputs.SiteOutputPath }}'
541
+
542
+ $functionDocsFolderPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Functions'
543
+ $functionDocsFolder = New-Item -Path $functionDocsFolderPath -ItemType Directory -Force
544
+ Copy-Item -Path $DocsOutputPath -Destination $functionDocsFolder -Recurse -Force
545
+ Get-ChildItem -Path $functionDocsFolder -Recurse -Force -Include '*.md' | ForEach-Object {
546
+ $fileName = $_.Name
547
+ $hash = (Get-FileHash -Path $_.FullName -Algorithm SHA256).Hash
548
+ LogGroup " - [$fileName] - [$hash]" {
549
+ Show-FileContent -Path $_
550
+ }
551
+ }
573
552
574
- Start-LogGroup 'Build docs - Create mkdocs.yml'
575
- $rootPath = Split-Path -Path $ModuleSourcePath -Parent
576
- # This should be moved to an action so that we can use a default one, and not have to copy it from the repo.
577
- $mkdocsSourcePath = Join-Path -Path $rootPath -ChildPath 'mkdocs.yml'
578
- $mkdocsTargetPath = Join-Path -Path $SiteOutputPath -ChildPath 'mkdocs.yml'
579
- $mkdocsContent = Get-Content -Path $mkdocsSourcePath -Raw
580
- $mkdocsContent = $mkdocsContent.Replace('-{{ REPO_NAME }}-', $ModuleName)
581
- $mkdocsContent = $mkdocsContent.Replace('-{{ REPO_OWNER }}-', $env:GITHUB_REPOSITORY_OWNER)
582
- $mkdocsContent | Set-Content -Path $mkdocsTargetPath -Force
583
- Show-FileContent -Path $mkdocsTargetPath
584
- Stop-LogGroup
553
+ LogGroup 'Build docs - Process about topics' {
554
+ $aboutDocsFolderPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/About'
555
+ $aboutDocsFolder = New-Item -Path $aboutDocsFolderPath -ItemType Directory -Force
556
+ $aboutSourceFolder = Get-ChildItem -Path $ModuleSourcePath -Directory | Where-Object { $_.Name -eq 'en-US' }
557
+ Get-ChildItem -Path $aboutSourceFolder -Filter *.txt | Copy-Item -Destination $aboutDocsFolder -Force -Verbose -PassThru |
558
+ Rename-Item -NewName { $_.Name -replace '.txt', '.md' }
559
+ }
560
+
561
+ LogGroup 'Build docs - Copy icon to assets' {
562
+ $assetsFolderPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Assets'
563
+ $null = New-Item -Path $assetsFolderPath -ItemType Directory -Force
564
+ $rootPath = Split-Path -Path $ModuleSourcePath -Parent
565
+ $iconPath = Join-Path -Path $rootPath -ChildPath 'icon\icon.png'
566
+ Copy-Item -Path $iconPath -Destination $assetsFolderPath -Force -Verbose
567
+ }
568
+
569
+ LogGroup 'Build docs - Copy readme.md' {
570
+ $rootPath = Split-Path -Path $ModuleSourcePath -Parent
571
+ $readmePath = Join-Path -Path $rootPath -ChildPath 'README.md'
572
+ $readmeTargetPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/README.md'
573
+ Copy-Item -Path $readmePath -Destination $readmeTargetPath -Force -Verbose
574
+ }
575
+
576
+ LogGroup 'Build docs - Create mkdocs.yml' {
577
+ $rootPath = Split-Path -Path $ModuleSourcePath -Parent
578
+ # This should be moved to an action so that we can use a default one, and not have to copy it from the repo.
579
+ $mkdocsSourcePath = Join-Path -Path $rootPath -ChildPath 'mkdocs.yml'
580
+ $mkdocsTargetPath = Join-Path -Path $SiteOutputPath -ChildPath 'mkdocs.yml'
581
+ $mkdocsContent = Get-Content -Path $mkdocsSourcePath -Raw
582
+ $mkdocsContent = $mkdocsContent.Replace('-{{ REPO_NAME }}-', $ModuleName)
583
+ $mkdocsContent = $mkdocsContent.Replace('-{{ REPO_OWNER }}-', $env:GITHUB_REPOSITORY_OWNER)
584
+ $mkdocsContent | Set-Content -Path $mkdocsTargetPath -Force
585
+ Show-FileContent -Path $mkdocsTargetPath
586
+ }
585
587
586
588
- name : Debug File system
587
589
shell : pwsh
0 commit comments