Skip to content

Commit

Permalink
fix import module
Browse files Browse the repository at this point in the history
  • Loading branch information
hjorslev committed Apr 28, 2024
1 parent ccdc830 commit 1d49403
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}

docs:
name: 📄 Docs
runs-on: windows-latest
needs:
- build
- test
steps:
- name: 🚚 Check out repository
uses: actions/checkout@v2
Expand All @@ -147,34 +147,21 @@ jobs:
name: PSModule
path: output

- name: 📦 Install Built PowerShell Module
- name: 📦 Import PowerShell Module
shell: pwsh
run: |
# Get the manifest from the newly built module.
$manifestItem = Get-Item ([IO.Path]::Combine('SteamPS', '*.psd1'))
$moduleName = $manifestItem.BaseName
$Manifest = Test-ModuleManifest -Path $manifestItem.FullName -ErrorAction SilentlyContinue -WarningAction Ignore
if ($env:BUILD_CONFIGURATION -eq 'Release') {
$Version = $env:GITHUB_REF -replace '^refs/tags/v(\d+\.\d+\.\d+)', '$1'
} else {
$Version = $Manifest.Version
}
$destPath = [IO.Path]::Combine('output', $moduleName, $Version)
if (-not (Test-Path -LiteralPath $destPath)) {
New-Item -Path $destPath -ItemType Directory | Out-Null
}
Get-ChildItem output/*.nupkg | Rename-Item -NewName { $_.Name -replace '.nupkg', '.zip' }
Expand-Archive -Path output/*.zip -DestinationPath $destPath -Force -ErrorAction Stop
$modulePath = (Get-ChildItem -Path output/*.nupkg -Name)
$moduleName = ($modulePath -replace '.nupkg$', '')
$moduleDir = "output/$moduleName"
Expand-Archive -Path "output/$modulePath" -DestinationPath $moduleDir
$moduleManifest = (Get-ChildItem -Path "$moduleDir/*.psd1" -Name)
Import-Module -Name "$moduleDir/$moduleManifest" -Force
- name: 📦 Update documentation
shell: pwsh
run: |
Install-Module -Name platyPS -Force
Update-MarkdownHelpModule .\docs\ -AlphabeticParamsOrder -RefreshModulePage -UpdateInputOutput -ModulePagePath .\docs\index.md
Update-MarkdownHelpModule -Path .\docs\ -Module $moduleName -AlphabeticParamsOrder -RefreshModulePage -UpdateInputOutput -ModulePagePath .\docs\index.md
- name: 📦 Commit and push changes
run: |
Expand All @@ -184,6 +171,7 @@ jobs:
git commit -m "Update documentation"
git push
publish:
name: 🚀 Deploy
if: startsWith(github.ref, 'refs/tags/v')
Expand Down

0 comments on commit 1d49403

Please sign in to comment.