.NET package CD #4
This file contains 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: .NET package CD | |
on: [workflow_dispatch] | |
defaults: | |
run: | |
working-directory: BrowserStackLocal | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Add msbuild to PATH | |
uses: microsoft/[email protected] | |
- name: Build BrowserStackLocal | |
run: | | |
msbuild BrowserStackLocal -t:restore -p:Configuration=Release | |
msbuild BrowserStackLocal -t:build -p:Configuration=Release | |
- name: Build Test project | |
run: | | |
msbuild BrowserStackLocalIntegrationTests -t:restore -p:Configuration=Release | |
msbuild BrowserStackLocalIntegrationTests -t:build -p:Configuration=Release | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 3.1.301 | |
- name: Run Integration Tests | |
env: | |
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | |
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | |
run: dotnet test BrowserStackLocalIntegrationTests --no-build -p:Configuration=Release | |
- name: Pack NuGet Package | |
run: msbuild BrowserStackLocal -t:pack -p:Configuration=Release | |
- name: Setup nuget | |
uses: nuget/setup-nuget@v1 | |
with: | |
nuget-api-key: ${{ secrets.NUGET_API_KEY }} | |
nuget-version: '5.x' | |
- name: Create PFX certificate | |
id: createPfx | |
shell: pwsh | |
env: | |
PFX_CONTENT: ${{ secrets.BASE64_PFX_CONTENT }} | |
run: | | |
$pfxPath = Join-Path -Path $env:RUNNER_TEMP -ChildPath "cert.pfx"; | |
$encodedBytes = [System.Convert]::FromBase64String($env:PFX_CONTENT); | |
Set-Content $pfxPath -Value $encodedBytes -AsByteStream; | |
Write-Output "::set-output name=PFX_PATH::$pfxPath"; | |
- name: Sign Nuget Package | |
run: nuget sign .\BrowserStackLocal\bin\Release\*.nupkg -certificatePath "${{ steps.createPfx.outputs.PFX_PATH }}" -certificatePassword "${{secrets.CERT_PASSWORD}}" -Timestamper "http://timestamp.comodoca.com" | |
- name: Save artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: BrowserStackLocal.nupkg | |
path: .\BrowserStackLocal\BrowserStackLocal\bin\Release\*.nupkg | |
- name: Push package to Nuget Repository | |
run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}} |