added support for connecting to sovereign clouds #51
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-CosmosLite | |
| on: | |
| push: | |
| branches: | |
| - master | |
| paths-ignore: | |
| - '**' | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| publish: | |
| type: boolean | |
| description: 'Publish to powershell gallery' | |
| required: false | |
| default: false | |
| jobs: | |
| # This workflow contains a single job called "publishToGallery" | |
| publishToGallery: | |
| # The type of runner that the job will run on | |
| runs-on: windows-latest | |
| env: | |
| MODULE_NAME: CosmosLite | |
| # Steps represent a sequence of tasks that will be executed as part of the job | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Copy License | |
| shell: pwsh | |
| run: | | |
| $moduleName = $env:MODULE_NAME | |
| Copy-Item -Path "$env:GITHUB_WORKSPACE\LICENSE" -Destination "$env:GITHUB_WORKSPACE\Module\$moduleName\LICENSE.txt" -Force | |
| - name: Build Module | |
| uses: GreyCorbel/PsModuleActions/build-module@v2 | |
| with: | |
| module-name: ${{ env.MODULE_NAME }} | |
| - name: Install AzureSignTool | |
| shell: pwsh | |
| run: | | |
| dotnet tool install --global AzureSignTool | |
| - name: Sign files | |
| shell: pwsh | |
| run: | | |
| $files = Get-ChildItem "$env:GITHUB_WORKSPACE\Module" -File -Recurse -Include *.ps1, *.ps1xml, *.psd1, *.psm1, *.pssc, *.psrc, *.cdxml | |
| try { | |
| foreach ($file in $files) { | |
| azuresigntool sign ` | |
| -kvu ${{ vars.CODESIGNING_KEYVAULTURI }} ` | |
| -kvi ${{ vars.TENANTINTEGRATION_CLIENTID }} ` | |
| -kvt ${{ vars.TENANTINTEGRATION_TENANTID }} ` | |
| -kvs ${{ secrets.TENANTINTEGRATION_CLIENTSECRET }} ` | |
| -kvc ${{ vars.CODESIGNING_CERTNAME }} ` | |
| -tr 'http://timestamp.digicert.com' ` | |
| -v "$($file.FullName)" | |
| } | |
| } | |
| catch { | |
| Write-Host "Error: $($_.Exception)" | |
| throw | |
| } | |
| Write-Host "Signed files summary:" | |
| Get-AuthenticodeSignature -FilePath $files | |
| - name: Publish | |
| #Publish to PS Gallery | |
| if: ${{ (github.event_name != 'workflow_dispatch') || github.event.inputs.publish }} | |
| shell: pwsh | |
| env: | |
| SECRET: ${{ secrets.GC_PSGALLERY_APIKEY }} | |
| run: | | |
| # see https://github.com/PowerShell/PSResourceGet/issues/1806 | |
| Get-PSResourceRepository | out-null | |
| write-host "Publishing from: $env:GITHUB_WORKSPACE\Module\CosmosLite" | |
| try | |
| { | |
| #setup PSModulePath | |
| $env:PSModulePath = "$env:PSModulePath;$env:GITHUB_WORKSPACE\Module" | |
| "PSModulePath: $env:PSModulePath" | |
| Publish-PSResource -Path "$env:GITHUB_WORKSPACE\Module\CosmosLite" -Repository PSGallery -APIKey "$env:SECRET" | |
| } | |
| catch | |
| { | |
| Write-Host "Error: $($_.Exception)" | |
| throw | |
| } |