Skip to content

Commit c26f0d9

Browse files
committed
(#18) Build docs automatically
With this commit the build pipeline will handle processing of the PowerShell scripts, writing Markdown help from them. It will then call on mkdocs in the pipeline to create a new version of the docs.
1 parent c8a6ba9 commit c26f0d9

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,19 @@ jobs:
6262
draft: false
6363
prerelease: ${{ github.ref != 'refs/heads/main' }}
6464

65+
- name: Write MD Docs with PlatyPS
66+
run: .\build.ps1 -WriteMdDocs -SemVer "${{ steps.gitversion.outputs.LegacySemVerPadded }}"
67+
shell: pwsh
68+
69+
- name: Deploy docs
70+
uses: mhausenblas/mkdocs-deploy-gh-pages@nomaterial
71+
# Or use mhausenblas/mkdocs-deploy-gh-pages@nomaterial to build without the mkdocs-material theme
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
CONFIG_FILE: .\mkdocs_template\mkdocs.yml
75+
EXTRA_PACKAGES: build-base
76+
# GITHUB_DOMAIN: github.myenterprise.com
77+
6578
- name: Publish Module
6679
if: ${{ github.ref == 'refs/heads/main' }}
6780
run: .\build.ps1 -DeployToGallery -SemVer "${{ steps.gitversion.outputs.LegacySemVerPadded }}"

build.ps1

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,40 @@ process {
9292
choco push $_.FullName -s https://push.chocolatey.org --api-key="'$($env:ChocoApiKey)'"
9393
}
9494
}
95+
96+
$WriteMdDocs {
97+
if (Test-Path $root\Output\BeautifulDocs) {
98+
if ($env:PSModulePath.Split(';') -notcontains "$root\Output") {
99+
$env:PSModulePath = "$root\Output;$env:PSModulePath"
100+
}
101+
Import-Module BeautifulDocs -Force
102+
Import-Module PlatyPS -Force
103+
104+
New-MarkdownHelp -Module BeautifulDocs -OutputFolder $root\docs
105+
106+
}
107+
}
108+
109+
$MkDocsPublish {
110+
$mkDocsRoot = Join-Path $root 'mkdocs_template'
111+
Push-Location $mkDocsRoot
112+
$mkDocsArgs = @('build')
113+
114+
& 'C:\Python39\Scripts\mkdocs.exe' @mkDocsArgs
115+
}
116+
117+
$GHPages {
118+
# Write your PowerShell commands here.
119+
git config --global user.name 'Stephen Valdinger'
120+
git config --global user.email '[email protected]'
121+
git remote rm origin
122+
$url = 'https://steviecoaster:' + $env:GH_TOKEN + '@github.com/steviecoaster/BeautifulDocs.git'
123+
git remote add origin $url
124+
125+
$mkDocsArgs = @('gh-deploy','--force')
126+
127+
Set-Location .\mkdocs_template
128+
& 'C:\Python39\Scripts\mkdocs.exe' @mkDocsArgs
129+
}
95130
}
96131
}

0 commit comments

Comments
 (0)