From f25c6a5f40f1fb53de6fb633f5808b4d1b952470 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 7 Dec 2024 15:04:41 +0100 Subject: [PATCH 1/8] Fix an issue with generating docs if name is not specified --- .github/workflows/workflow.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 8f3d8e60..ba96b579 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -528,11 +528,7 @@ jobs: uses: PSModule/GitHub-Script@v1 with: Script: | - $ModuleName = '${{ inputs.Name }}' - - if (-not $ModuleName) { - $ModuleName = $env:GITHUB_REPOSITORY -replace '.+/' - } + $moduleName = [string]::IsNullOrEmpty('${{ inputs.Name }}') ? $env:GITHUB_REPOSITORY_NAME : '${{ inputs.Name }}' Write-Verbose "Module name: $ModuleName" $ModuleSourcePath = Join-Path (Get-Location) -ChildPath '${{ inputs.Path }}' From 9a906abc8741ab54bc1dd71d5120babbda4b20ca Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 7 Dec 2024 15:08:24 +0100 Subject: [PATCH 2/8] update the CI pipeline aswell... need some dedup here :) --- .github/workflows/CI.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 72369531..034955e5 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -495,11 +495,7 @@ jobs: uses: PSModule/GitHub-Script@v1 with: Script: | - $ModuleName = '${{ inputs.Name }}' - - if (-not $ModuleName) { - $ModuleName = $env:GITHUB_REPOSITORY -replace '.+/' - } + $moduleName = [string]::IsNullOrEmpty('${{ inputs.Name }}') ? $env:GITHUB_REPOSITORY_NAME : '${{ inputs.Name }}' Write-Verbose "Module name: $ModuleName" $ModuleSourcePath = Join-Path (Get-Location) -ChildPath '${{ inputs.Path }}' @@ -508,7 +504,7 @@ jobs: $functionDocsFolderPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Functions' $functionDocsFolder = New-Item -Path $functionDocsFolderPath -ItemType Directory -Force - Get-ChildItem -Path $DocsOutputPath -Recurse -Force -Include '*.md' | Copy-Item -Destination $functionDocsFolder -Recurse -Force + Copy-Item -Path $DocsOutputPath -Destination $functionDocsFolder -Recurse -Force Get-ChildItem -Path $functionDocsFolder -Recurse -Force -Include '*.md' | ForEach-Object { $fileName = $_.Name $hash = (Get-FileHash -Path $_.FullName -Algorithm SHA256).Hash From 522b48981301a1a5cca88f154597c21f627a5dec Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 7 Dec 2024 16:25:48 +0100 Subject: [PATCH 3/8] test --- .github/workflows/workflow.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index ba96b579..50500f85 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -529,11 +529,11 @@ jobs: with: Script: | $moduleName = [string]::IsNullOrEmpty('${{ inputs.Name }}') ? $env:GITHUB_REPOSITORY_NAME : '${{ inputs.Name }}' - Write-Verbose "Module name: $ModuleName" + Write-Verbose "Module name: $ModuleName" -Verbose - $ModuleSourcePath = Join-Path (Get-Location) -ChildPath '${{ inputs.Path }}' - $DocsOutputPath = Join-Path (Get-Location) -ChildPath "${{ inputs.DocsOutputPath }}/$ModuleName" - $SiteOutputPath = Join-Path (Get-Location) -ChildPath '${{ inputs.SiteOutputPath }}' + $ModuleSourcePath = Join-Path $PWD -ChildPath '${{ inputs.Path }}' + $DocsOutputPath = Join-Path $PWD -ChildPath "${{ inputs.DocsOutputPath }}" + $SiteOutputPath = Join-Path $PWD -ChildPath '${{ inputs.SiteOutputPath }}' $functionDocsFolderPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Functions' $functionDocsFolder = New-Item -Path $functionDocsFolderPath -ItemType Directory -Force From 134c5b7b2753dff2c13485e97d36d86b2e5f332e Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 7 Dec 2024 16:32:31 +0100 Subject: [PATCH 4/8] test --- .github/workflows/workflow.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 50500f85..4c74e96b 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -535,6 +535,10 @@ jobs: $DocsOutputPath = Join-Path $PWD -ChildPath "${{ inputs.DocsOutputPath }}" $SiteOutputPath = Join-Path $PWD -ChildPath '${{ inputs.SiteOutputPath }}' + Write-Verbose "Module source path: $ModuleSourcePath" -Verbose + Write-Verbose "Docs output path: $DocsOutputPath" -Verbose + Write-Verbose "Site output path: $SiteOutputPath" -Verbose + $functionDocsFolderPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Functions' $functionDocsFolder = New-Item -Path $functionDocsFolderPath -ItemType Directory -Force Copy-Item -Path $DocsOutputPath -Destination $functionDocsFolder -Recurse -Force From 4b732d6187935b0f52a60dceef1ed72ff7cc0c24 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 7 Dec 2024 16:34:42 +0100 Subject: [PATCH 5/8] Fix CI --- .github/workflows/CI.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 034955e5..ff27f9c7 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -496,11 +496,15 @@ jobs: with: Script: | $moduleName = [string]::IsNullOrEmpty('${{ inputs.Name }}') ? $env:GITHUB_REPOSITORY_NAME : '${{ inputs.Name }}' - Write-Verbose "Module name: $ModuleName" + Write-Verbose "Module name: $ModuleName" -Verbose - $ModuleSourcePath = Join-Path (Get-Location) -ChildPath '${{ inputs.Path }}' - $DocsOutputPath = Join-Path (Get-Location) -ChildPath "${{ inputs.DocsOutputPath }}/$ModuleName" - $SiteOutputPath = Join-Path (Get-Location) -ChildPath '${{ inputs.SiteOutputPath }}' + $ModuleSourcePath = Join-Path $PWD -ChildPath '${{ inputs.Path }}' + $DocsOutputPath = Join-Path $PWD -ChildPath "${{ inputs.DocsOutputPath }}" + $SiteOutputPath = Join-Path $PWD -ChildPath '${{ inputs.SiteOutputPath }}' + + Write-Verbose "Module source path: $ModuleSourcePath" -Verbose + Write-Verbose "Docs output path: $DocsOutputPath" -Verbose + Write-Verbose "Site output path: $SiteOutputPath" -Verbose $functionDocsFolderPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Functions' $functionDocsFolder = New-Item -Path $functionDocsFolderPath -ItemType Directory -Force From ff922e35484a55b1cc1a9e2c4ff122aff91838b5 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 7 Dec 2024 16:50:04 +0100 Subject: [PATCH 6/8] Just use sitepath directly --- .github/workflows/workflow.yml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 4c74e96b..00389a5c 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -502,7 +502,7 @@ jobs: uses: actions/download-artifact@v4 with: name: docs - path: ${{ inputs.DocsOutputPath }} + path: '${{ inputs.SiteOutputPath }}/docs/Functions' - name: Debug File system shell: pwsh @@ -529,19 +529,9 @@ jobs: with: Script: | $moduleName = [string]::IsNullOrEmpty('${{ inputs.Name }}') ? $env:GITHUB_REPOSITORY_NAME : '${{ inputs.Name }}' - Write-Verbose "Module name: $ModuleName" -Verbose - - $ModuleSourcePath = Join-Path $PWD -ChildPath '${{ inputs.Path }}' - $DocsOutputPath = Join-Path $PWD -ChildPath "${{ inputs.DocsOutputPath }}" $SiteOutputPath = Join-Path $PWD -ChildPath '${{ inputs.SiteOutputPath }}' - Write-Verbose "Module source path: $ModuleSourcePath" -Verbose - Write-Verbose "Docs output path: $DocsOutputPath" -Verbose - Write-Verbose "Site output path: $SiteOutputPath" -Verbose - - $functionDocsFolderPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Functions' - $functionDocsFolder = New-Item -Path $functionDocsFolderPath -ItemType Directory -Force - Copy-Item -Path $DocsOutputPath -Destination $functionDocsFolder -Recurse -Force + $functionDocsFolder = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Functions' | Get-Item Get-ChildItem -Path $functionDocsFolder -Recurse -Force -Include '*.md' | ForEach-Object { $fileName = $_.Name $hash = (Get-FileHash -Path $_.FullName -Algorithm SHA256).Hash From 4139a94347780ef187255e1a3b86831657680a28 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 7 Dec 2024 16:51:24 +0100 Subject: [PATCH 7/8] Fix CI too --- .github/workflows/CI.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ff27f9c7..1f82673e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -496,19 +496,9 @@ jobs: with: Script: | $moduleName = [string]::IsNullOrEmpty('${{ inputs.Name }}') ? $env:GITHUB_REPOSITORY_NAME : '${{ inputs.Name }}' - Write-Verbose "Module name: $ModuleName" -Verbose - - $ModuleSourcePath = Join-Path $PWD -ChildPath '${{ inputs.Path }}' - $DocsOutputPath = Join-Path $PWD -ChildPath "${{ inputs.DocsOutputPath }}" $SiteOutputPath = Join-Path $PWD -ChildPath '${{ inputs.SiteOutputPath }}' - Write-Verbose "Module source path: $ModuleSourcePath" -Verbose - Write-Verbose "Docs output path: $DocsOutputPath" -Verbose - Write-Verbose "Site output path: $SiteOutputPath" -Verbose - - $functionDocsFolderPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Functions' - $functionDocsFolder = New-Item -Path $functionDocsFolderPath -ItemType Directory -Force - Copy-Item -Path $DocsOutputPath -Destination $functionDocsFolder -Recurse -Force + $functionDocsFolder = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Functions' | Get-Item Get-ChildItem -Path $functionDocsFolder -Recurse -Force -Include '*.md' | ForEach-Object { $fileName = $_.Name $hash = (Get-FileHash -Path $_.FullName -Algorithm SHA256).Hash From e8841887f211c489e7c716675203d95c225971c7 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 7 Dec 2024 17:05:49 +0100 Subject: [PATCH 8/8] Update CI workflow to use SiteOutputPath for documentation and streamline debug steps --- .github/workflows/CI.yml | 3 ++- .github/workflows/workflow.yml | 12 +++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 1f82673e..09719661 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -476,7 +476,7 @@ jobs: uses: actions/download-artifact@v4 with: name: docs - path: ${{ inputs.DocsOutputPath }} + path: '${{ inputs.SiteOutputPath }}/docs/Functions' - name: Debug uses: PSModule/Debug@v0 @@ -496,6 +496,7 @@ jobs: with: Script: | $moduleName = [string]::IsNullOrEmpty('${{ inputs.Name }}') ? $env:GITHUB_REPOSITORY_NAME : '${{ inputs.Name }}' + $ModuleSourcePath = Join-Path $PWD -ChildPath '${{ inputs.Path }}' $SiteOutputPath = Join-Path $PWD -ChildPath '${{ inputs.SiteOutputPath }}' $functionDocsFolder = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Functions' | Get-Item diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 00389a5c..a0aa1195 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -504,15 +504,8 @@ jobs: name: docs path: '${{ inputs.SiteOutputPath }}/docs/Functions' - - name: Debug File system - shell: pwsh - run: | - Get-ChildItem -Path $env:GITHUB_WORKSPACE -Recurse | Select-Object -ExpandProperty FullName | Sort-Object - - - name: Debug Env vars - shell: pwsh - run: | - Get-ChildItem env: | Format-Table + - name: Debug + uses: PSModule/Debug@v0 - uses: actions/configure-pages@v5 @@ -529,6 +522,7 @@ jobs: with: Script: | $moduleName = [string]::IsNullOrEmpty('${{ inputs.Name }}') ? $env:GITHUB_REPOSITORY_NAME : '${{ inputs.Name }}' + $ModuleSourcePath = Join-Path $PWD -ChildPath '${{ inputs.Path }}' $SiteOutputPath = Join-Path $PWD -ChildPath '${{ inputs.SiteOutputPath }}' $functionDocsFolder = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Functions' | Get-Item