|
1 | | -- name: Install PSResourceGet |
2 | | - shell: pwsh |
3 | | - run: Install-Module Microsoft.PowerShell.PSResourceGet -Force -Scope CurrentUser |
| 1 | +name: Publish PowerShell Gallery |
| 2 | +on: |
| 3 | + push: |
| 4 | + tags: ['v*'] |
4 | 5 |
|
5 | | -- name: Run Pester tests |
6 | | - shell: pwsh |
7 | | - run: | |
8 | | - Import-Module "$PWD\NicolasAigner.SystemToolkit.psd1" -Force |
9 | | - Invoke-Pester -CI |
| 6 | +jobs: |
| 7 | + publish: |
| 8 | + runs-on: windows-latest |
10 | 9 |
|
11 | | -- name: Ensure PSGallery repo exists |
12 | | - shell: pwsh |
13 | | - run: | |
14 | | - $repo = Get-PSResourceRepository -Name PSGallery -ErrorAction SilentlyContinue |
15 | | - if (-not $repo) { |
16 | | - Register-PSResourceRepository -Name PSGallery ` |
17 | | - -Uri 'https://www.powershellgallery.com/api/v2' ` |
18 | | - -Trusted |
19 | | - } |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v4 |
| 12 | + - name: Install PSResourceGet |
| 13 | + shell: pwsh |
| 14 | + run: Install-Module Microsoft.PowerShell.PSResourceGet -Force -Scope CurrentUser |
20 | 15 |
|
21 | | -- name: Publish module |
22 | | - shell: pwsh |
23 | | - env: |
24 | | - PSGALLERY_APIKEY: ${{ secrets.PSGALLERY_APIKEY }} |
25 | | - run: | |
26 | | - Publish-PSResource -Path . ` |
27 | | - -Repository PSGallery ` |
28 | | - -ApiKey $env:PSGALLERY_APIKEY |
| 16 | + - name: Run Pester tests |
| 17 | + shell: pwsh |
| 18 | + run: | |
| 19 | + Import-Module "$PWD\NicolasAigner.SystemToolkit.psd1" -Force |
| 20 | + Invoke-Pester -CI |
| 21 | +
|
| 22 | + - name: Ensure PSGallery repo exists # ← novo |
| 23 | + shell: pwsh |
| 24 | + run: | |
| 25 | + $repo = Get-PSResourceRepository -Name PSGallery -ErrorAction SilentlyContinue |
| 26 | + if (-not $repo) { |
| 27 | + Register-PSResourceRepository -Name PSGallery ` |
| 28 | + -Uri 'https://www.powershellgallery.com/api/v2' ` |
| 29 | + -Trusted |
| 30 | + } |
| 31 | +
|
| 32 | + - name: Publish module |
| 33 | + shell: pwsh |
| 34 | + env: |
| 35 | + PSGALLERY_APIKEY: ${{ secrets.PSGALLERY_APIKEY }} |
| 36 | + run: | |
| 37 | + Publish-PSResource -Path . ` |
| 38 | + -Repository PSGallery ` |
| 39 | + -ApiKey $env:PSGALLERY_APIKEY |
0 commit comments