Skip to content

Commit 7908e3c

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 7908e3c

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-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: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ param(
1616
[Switch]
1717
$DeployToGallery,
1818

19+
[Parameter()]
20+
[Switch]
21+
$WriteMdDocs,
22+
23+
[Parameter()]
24+
[Switch]
25+
$MkDocsPublish,
26+
27+
[Parameter()]
28+
[Switch]
29+
$GHPages,
30+
1931
[Parameter()]
2032
[Switch]
2133
$Choco,
@@ -92,5 +104,40 @@ process {
92104
choco push $_.FullName -s https://push.chocolatey.org --api-key="'$($env:ChocoApiKey)'"
93105
}
94106
}
107+
108+
$WriteMdDocs {
109+
if (Test-Path $root\Output\BeautifulDocs) {
110+
if ($env:PSModulePath.Split(';') -notcontains "$root\Output") {
111+
$env:PSModulePath = "$root\Output;$env:PSModulePath"
112+
}
113+
Import-Module BeautifulDocs -Force
114+
Import-Module PlatyPS -Force
115+
116+
New-MarkdownHelp -Module BeautifulDocs -OutputFolder $root\docs
117+
118+
}
119+
}
120+
121+
$MkDocsPublish {
122+
$mkDocsRoot = Join-Path $root 'mkdocs_template'
123+
Push-Location $mkDocsRoot
124+
$mkDocsArgs = @('build')
125+
126+
& 'C:\Python39\Scripts\mkdocs.exe' @mkDocsArgs
127+
}
128+
129+
$GHPages {
130+
# Write your PowerShell commands here.
131+
git config --global user.name 'Stephen Valdinger'
132+
git config --global user.email '[email protected]'
133+
git remote rm origin
134+
$url = 'https://steviecoaster:' + $env:GH_TOKEN + '@github.com/steviecoaster/BeautifulDocs.git'
135+
git remote add origin $url
136+
137+
$mkDocsArgs = @('gh-deploy','--force')
138+
139+
Set-Location .\mkdocs_template
140+
& 'C:\Python39\Scripts\mkdocs.exe' @mkDocsArgs
141+
}
95142
}
96143
}

0 commit comments

Comments
 (0)