publish to powershell gallery #73
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 to powershell gallery | |
| on: | |
| push: | |
| branches: [master] | |
| paths: | |
| - "**.psd1" | |
| workflow_dispatch: | |
| jobs: | |
| publishmodule: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dlemstra/code-sign-action@v1 | |
| with: | |
| certificate: ${{ secrets.CERTIFICATE }} | |
| password: ${{ secrets.CERTIFICATE_PASSWORD }} | |
| folder: . | |
| recursive: true | |
| files: | | |
| *.ps1 | |
| *.psm1 | |
| - name: publish to powershell gallery | |
| shell: pwsh | |
| env: | |
| nugetkey: ${{secrets.NUGETKEY}} | |
| run: | | |
| Register-PSResourceRepository -PSGallery -Trusted | |
| $data = Import-PowerShellDataFile .\code365scripts.openai\code365scripts.openai.psd1 | |
| if($data.RequiredModules) { | |
| $data.RequiredModules | Foreach-Object {Install-Module -Name $_.ModuleName -RequiredVersion $_.ModuleVersion } | |
| } | |
| Remove-Item -Path ".git" -Recurse -Force | |
| Remove-Item -Path ".github" -Recurse -Force | |
| Remove-Item -Path ".vscode" -Recurse -Force | |
| Publish-PSResource -ApiKey $env:nugetkey -Path code365scripts.openai -Repository PSGallery |