|
| 1 | +name: .NET package CD |
| 2 | + |
| 3 | +on: [workflow_dispatch] |
| 4 | + |
| 5 | +defaults: |
| 6 | + run: |
| 7 | + working-directory: BrowserStackLocal |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + runs-on: windows-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v2 |
| 15 | + - name: Add msbuild to PATH |
| 16 | + |
| 17 | + - name: Build BrowserStackLocal |
| 18 | + run: | |
| 19 | + msbuild BrowserStackLocal -t:restore -p:Configuration=Release |
| 20 | + msbuild BrowserStackLocal -t:build -p:Configuration=Release |
| 21 | + - name: Build Test project |
| 22 | + run: | |
| 23 | + msbuild BrowserStackLocalIntegrationTests -t:restore -p:Configuration=Release |
| 24 | + msbuild BrowserStackLocalIntegrationTests -t:build -p:Configuration=Release |
| 25 | + - name: Setup .NET Core |
| 26 | + uses: actions/setup-dotnet@v1 |
| 27 | + with: |
| 28 | + dotnet-version: 3.1.301 |
| 29 | + - name: Run Integration Tests |
| 30 | + env: |
| 31 | + BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} |
| 32 | + BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} |
| 33 | + run: dotnet test BrowserStackLocalIntegrationTests --no-build -p:Configuration=Release |
| 34 | + - name: Pack NuGet Package |
| 35 | + run: msbuild BrowserStackLocal -t:pack -p:Configuration=Release |
| 36 | + - name: Setup nuget |
| 37 | + uses: nuget/setup-nuget@v1 |
| 38 | + with: |
| 39 | + nuget-api-key: ${{ secrets.NUGET_API_KEY }} |
| 40 | + nuget-version: '5.x' |
| 41 | + - name: Create PFX certificate |
| 42 | + id: createPfx |
| 43 | + shell: pwsh |
| 44 | + env: |
| 45 | + PFX_CONTENT: ${{ secrets.BASE64_PFX_CONTENT }} |
| 46 | + run: | |
| 47 | + $pfxPath = Join-Path -Path $env:RUNNER_TEMP -ChildPath "cert.pfx"; |
| 48 | + $encodedBytes = [System.Convert]::FromBase64String($env:PFX_CONTENT); |
| 49 | + Set-Content $pfxPath -Value $encodedBytes -AsByteStream; |
| 50 | + Write-Output "::set-output name=PFX_PATH::$pfxPath"; |
| 51 | + - name: Sign Nuget Package |
| 52 | + run: nuget sign .\BrowserStackLocal\bin\Release\*.nupkg -certificatePath "${{ steps.createPfx.outputs.PFX_PATH }}" -certificatePassword "${{secrets.CERT_PASSWORD}}" -Timestamper "http://timestamp.comodoca.com" |
| 53 | + - name: Save artifact |
| 54 | + uses: actions/upload-artifact@v2 |
| 55 | + with: |
| 56 | + name: BrowserStackLocal.nupkg |
| 57 | + path: .\BrowserStackLocal\BrowserStackLocal\bin\Release\*.nupkg |
| 58 | + - name: Push package to Nuget Repository |
| 59 | + run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}} |
0 commit comments