Skip to content

Commit d9e3d1c

Browse files
Refactor action.yml by removing unused inputs and streamlining the documentation build process
1 parent 486091a commit d9e3d1c

File tree

1 file changed

+0
-140
lines changed

1 file changed

+0
-140
lines changed

action.yml

Lines changed: 0 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@ inputs:
2525
description: Path to the folder where the built docs are outputted.
2626
required: false
2727
default: outputs/docs
28-
DocsArtifactName:
29-
description: Name of the docs artifact to upload.
30-
required: false
31-
default: docs
32-
SiteOutputPath:
33-
description: Path to the folder where the built site is outputted.
34-
required: false
35-
default: outputs/site
3628
Debug:
3729
description: Enable debug output.
3830
required: false
@@ -73,135 +65,3 @@ runs:
7365
Script: |
7466
# Build-PSModuleDocumentation
7567
${{ github.action_path }}\scripts\main.ps1
76-
77-
- name: Upload docs artifact
78-
uses: actions/upload-artifact@v4
79-
with:
80-
name: ${{ inputs.DocsArtifactName }}
81-
path: ${{ inputs.DocsOutputPath }}
82-
if-no-files-found: error
83-
retention-days: 1
84-
85-
- name: Commit all changes
86-
continue-on-error: true
87-
shell: pwsh
88-
run: |
89-
# Rename the gitignore file to .gitignore.bak
90-
Rename-Item -Path '.gitignore' -NewName '.gitignore.bak' -Force
91-
92-
try {
93-
# Add all changes to the repository
94-
git add .
95-
git commit -m 'Update documentation'
96-
} catch {
97-
Write-Host "No changes to commit"
98-
}
99-
100-
# Restore the gitignore file
101-
Rename-Item -Path '.gitignore.bak' -NewName '.gitignore' -Force
102-
103-
- name: Lint documentation
104-
uses: super-linter/super-linter/slim@latest
105-
env:
106-
FILTER_REGEX_INCLUDE: ${{ inputs.DocsOutputPath }}
107-
DEFAULT_BRANCH: main
108-
DEFAULT_WORKSPACE: ${{ github.workspace }}
109-
ENABLE_GITHUB_ACTIONS_GROUP_TITLE: true
110-
GITHUB_TOKEN: ${{ github.token }}
111-
RUN_LOCAL: true
112-
VALIDATE_ALL_CODEBASE: true
113-
VALIDATE_JSON_PRETTIER: false
114-
VALIDATE_MARKDOWN_PRETTIER: false
115-
VALIDATE_YAML_PRETTIER: false
116-
VALIDATE_JSCPD: false
117-
VALIDATE_GITLEAKS: false
118-
119-
- uses: actions/configure-pages@v5
120-
121-
- name: Install mkdoks-material
122-
shell: pwsh
123-
run: |
124-
pip install mkdocs-material
125-
pip install mkdocs-git-authors-plugin
126-
pip install mkdocs-git-revision-date-localized-plugin
127-
pip install mkdocs-git-committers-plugin-2
128-
129-
- name: Structure site
130-
uses: PSModule/GitHub-Script@v1
131-
with:
132-
Debug: ${{ inputs.Debug }}
133-
Prerelease: ${{ inputs.Prerelease }}
134-
Verbose: ${{ inputs.Verbose }}
135-
Version: ${{ inputs.Version }}
136-
Script: |
137-
New-Item -Path "$env:GITHUB_WORKSPACE/${{ inputs.SiteOutputPath }}/docs/Functions" -ItemType Directory -Force
138-
Copy-Item -Path "$env:GITHUB_WORKSPACE/${{ inputs.DocsOutputPath }}/*" -Destination "$env:GITHUB_WORKSPACE/${{ inputs.SiteOutputPath }}/docs/Functions" -Recurse -Force
139-
$moduleName = [string]::IsNullOrEmpty('${{ inputs.Name }}') ? $env:GITHUB_REPOSITORY_NAME : '${{ inputs.Name }}'
140-
$ModuleSourcePath = Join-Path $PWD -ChildPath '${{ inputs.Path }}'
141-
$SiteOutputPath = Join-Path $PWD -ChildPath '${{ inputs.SiteOutputPath }}'
142-
143-
LogGroup "Get folder structure" {
144-
Get-ChildItem -Recurse | Select-Object -ExpandProperty FullName | Sort-Object | Format-List
145-
}
146-
147-
$functionDocsFolder = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Functions' | Get-Item
148-
Get-ChildItem -Path $functionDocsFolder -Recurse -Force -Include '*.md' | ForEach-Object {
149-
$fileName = $_.Name
150-
LogGroup " - $fileName" {
151-
Show-FileContent -Path $_
152-
}
153-
}
154-
155-
LogGroup 'Build docs - Process about topics' {
156-
$aboutDocsFolderPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/About'
157-
$aboutDocsFolder = New-Item -Path $aboutDocsFolderPath -ItemType Directory -Force
158-
$aboutSourceFolder = Get-ChildItem -Path $ModuleSourcePath -Directory | Where-Object { $_.Name -eq 'en-US' }
159-
Get-ChildItem -Path $aboutSourceFolder -Filter *.txt | Copy-Item -Destination $aboutDocsFolder -Force -Verbose -PassThru |
160-
Rename-Item -NewName { $_.Name -replace '.txt', '.md' }
161-
}
162-
163-
LogGroup 'Build docs - Copy icon to assets' {
164-
$assetsFolderPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Assets'
165-
$null = New-Item -Path $assetsFolderPath -ItemType Directory -Force
166-
$rootPath = Split-Path -Path $ModuleSourcePath -Parent
167-
$iconPath = Join-Path -Path $rootPath -ChildPath 'icon\icon.png'
168-
Copy-Item -Path $iconPath -Destination $assetsFolderPath -Force -Verbose
169-
}
170-
171-
LogGroup 'Build docs - Copy readme.md' {
172-
$rootPath = Split-Path -Path $ModuleSourcePath -Parent
173-
$readmePath = Join-Path -Path $rootPath -ChildPath 'README.md'
174-
$readmeTargetPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/README.md'
175-
Copy-Item -Path $readmePath -Destination $readmeTargetPath -Force -Verbose
176-
}
177-
178-
LogGroup 'Build docs - Create mkdocs.yml' {
179-
$rootPath = Split-Path -Path $ModuleSourcePath -Parent
180-
# This should be moved to an action so that we can use a default one, and not have to copy it from the repo.
181-
$mkdocsSourcePath = Join-Path -Path $rootPath -ChildPath 'mkdocs.yml'
182-
$mkdocsTargetPath = Join-Path -Path $SiteOutputPath -ChildPath 'mkdocs.yml'
183-
$mkdocsContent = Get-Content -Path $mkdocsSourcePath -Raw
184-
$mkdocsContent = $mkdocsContent.Replace('-{{ REPO_NAME }}-', $ModuleName)
185-
$mkdocsContent = $mkdocsContent.Replace('-{{ REPO_OWNER }}-', $env:GITHUB_REPOSITORY_OWNER)
186-
$mkdocsContent | Set-Content -Path $mkdocsTargetPath -Force
187-
Show-FileContent -Path $mkdocsTargetPath
188-
}
189-
190-
- name: Debug File system
191-
shell: pwsh
192-
run: |
193-
Get-ChildItem -Path $env:GITHUB_WORKSPACE -Recurse | Select-Object -ExpandProperty FullName | Sort-Object
194-
195-
- name: Build mkdocs-material project
196-
working-directory: ${{ inputs.SiteOutputPath }}
197-
shell: pwsh
198-
run: |
199-
LogGroup 'Build docs - mkdocs build - content' {
200-
Show-FileContent -Path mkdocs.yml
201-
}
202-
203-
LogGroup 'Build docs - mkdocs build' {
204-
mkdocs build --config-file mkdocs.yml --site-dir ${{ github.workspace }}/_site
205-
}
206-
207-
- uses: actions/upload-pages-artifact@v3

0 commit comments

Comments
 (0)