Skip to content

Publish PowerShell Gallery #10

Publish PowerShell Gallery

Publish PowerShell Gallery #10

Workflow file for this run

name: Publish PowerShell Gallery
on:
push:
tags: ['v*']
jobs:
publish:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install PSResourceGet
shell: pwsh
run: Install-Module Microsoft.PowerShell.PSResourceGet -Force -Scope CurrentUser
- name: Run Pester tests
shell: pwsh
run: |
Import-Module "$PWD\NicolasAigner.SystemToolkit.psd1" -Force
Invoke-Pester -CI
- name: Ensure PSGallery repo exists # ← novo
shell: pwsh
run: |
$repo = Get-PSResourceRepository -Name PSGallery -ErrorAction SilentlyContinue
if (-not $repo) {
Register-PSResourceRepository -Name PSGallery `
-Uri 'https://www.powershellgallery.com/api/v2' `
-Trusted
}
- name: Publish module
shell: pwsh
env:
PSGALLERY_APIKEY: ${{ secrets.PSGALLERY_APIKEY }}
run: |
Publish-PSResource -Path . `
-Repository PSGallery `
-ApiKey $env:PSGALLERY_APIKEY