add power-shell yaml check #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish PowerShell Module to PowerShell Gallery | |
on: | |
push: | |
branches: | |
- main | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
jobs: | |
publish: | |
runs-on: windows-latest | |
steps: | |
# Checkout the repository | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Validate the module (ensure it loads correctly) | |
- name: Validate PowerShell Module | |
run: | | |
$manifest = Test-ModuleManifest -Path ./KubeTidy.psd1 | |
Write-Host "Validated Module Version: $($manifest.Version)" | |
# Publish to PowerShell Gallery | |
- name: Publish to PowerShell Gallery | |
run: | | |
Install-Module -Name PowerShellGet -Force -AllowClobber | |
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted | |
Publish-Module -Path ./ -NuGetApiKey $env:PSGALLERY_API_KEY -Repository PSGallery | |
env: | |
PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }} |