Publish PowerShell Gallery #10
Workflow file for this run
This file contains hidden or 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 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 |