Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ jobs:
- name: Install-RequiredModules
uses: PoshCode/Actions/install-requiredmodules@v1

- name: Install and cache PowerShell modules
uses: potatoqualitee/psmodulecache@v4
with:
modules-to-cache: PlatyPS:0.14.0

- name: Build Module
run: .\build.ps1 -Build -SemVer "${{ steps.gitversion.outputs.LegacySemVerPadded }}"
shell: pwsh
Expand Down Expand Up @@ -62,6 +67,20 @@ jobs:
draft: false
prerelease: ${{ github.ref != 'refs/heads/main' }}

- name: Write MD Docs with PlatyPS
if: ${{ github.ref == 'refs/heads/main' }}
run: .\build.ps1 -WriteMdDocs -SemVer "${{ steps.gitversion.outputs.LegacySemVerPadded }}"
shell: pwsh

- name: Deploy docs
uses: mhausenblas/mkdocs-deploy-gh-pages@nomaterial
# Or use mhausenblas/mkdocs-deploy-gh-pages@nomaterial to build without the mkdocs-material theme
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CONFIG_FILE: .\mkdocs_template\mkdocs.yml
EXTRA_PACKAGES: build-base
# GITHUB_DOMAIN: github.myenterprise.com

- name: Publish Module
if: ${{ github.ref == 'refs/heads/main' }}
run: .\build.ps1 -DeployToGallery -SemVer "${{ steps.gitversion.outputs.LegacySemVerPadded }}"
1 change: 1 addition & 0 deletions RequiredModules.psd1
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@{
ModuleBuilder = "[2.0.0,3.0)"
PlatyPS = "[0.14.0,0.14.2)"
}
47 changes: 47 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ param(
[Switch]
$DeployToGallery,

[Parameter()]
[Switch]
$WriteMdDocs,

[Parameter()]
[Switch]
$MkDocsPublish,

[Parameter()]
[Switch]
$GHPages,

[Parameter()]
[Switch]
$Choco,
Expand Down Expand Up @@ -92,5 +104,40 @@ process {
choco push $_.FullName -s https://push.chocolatey.org --api-key="'$($env:ChocoApiKey)'"
}
}

$WriteMdDocs {
if (Test-Path $root\Output\NexuShell) {
if ($env:PSModulePath.Split(';') -notcontains "$root\Output") {
$env:PSModulePath = "$root\Output;$env:PSModulePath"
}
Import-Module NexuShell -Force
Import-Module PlatyPS -Force

New-MarkdownHelp -Module NexuShell -OutputFolder $root\docs

}
}

$MkDocsPublish {
$mkDocsRoot = Join-Path $root 'mkdocs_template'
Push-Location $mkDocsRoot
$mkDocsArgs = @('build')

& 'C:\Python39\Scripts\mkdocs.exe' @mkDocsArgs
}

$GHPages {
# Write your PowerShell commands here.
git config --global user.name 'Stephen Valdinger'
git config --global user.email '[email protected]'
git remote rm origin
$url = 'https://steviecoaster:' + $env:GH_TOKEN + '@github.com/steviecoaster/NexuShell.git'
git remote add origin $url

$mkDocsArgs = @('gh-deploy','--force')

Set-Location .\mkdocs_template
& 'C:\Python39\Scripts\mkdocs.exe' @mkDocsArgs
}
}
}