Add modulepath #9
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: PSGallery Publish | |
env: | |
PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }} | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
publish-to-psgallery: | |
name: Publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Version Bump | |
shell: pwsh | |
run: | | |
$ErrorActionPreference = "Stop" | |
$env:PSModulePath = @($env:PSModulePath, ".\PwshSpectreConsole\") -join ";" | |
$version = Get-Module PwshSpectreConsole -ListAvailable | Sort-Object -Property Version -Descending | Select-Object -First 1 -ExpandProperty Version | |
if($null -eq $version) { throw "Failed to load version" } | |
$newVersion = [version]::new($version.Major, $version.Minor, $version.Build + 1) | |
Write-Host "Bumping version from $version to $newVersion" | |
Update-ModuleManifest -Path .\PwshSpectreConsole\PwshSpectreConsole.psd1 -ModuleVersion $newVersion | |
git add PwshSpectreConsole/PwshSpectreConsole.psd1 | |
git commit -m "Bump version to $newVersion" | |
git push | |
- name: Deploy Package | |
shell: pwsh | |
run: | | |
$ErrorActionPreference = "Stop" | |
& ./PwshSpectreConsole/Build.ps1 | |
Publish-Module -Path "./PwshSpectreConsole/" -NugetApiKey $env:PSGALLERY_API_KEY |