.NET package CD #9
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: .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/setup-msbuild@v1.0.2 | |
| - 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@v3 | |
| with: | |
| dotnet-version: 6.0.x | |
| - name: Setup GCP credentials | |
| working-directory: ${{ github.workspace }} | |
| run: | | |
| printf '%s' "$GCP_SA_KEY_RAW" > $RUNNER_TEMP/gcp-sa-key.json | |
| chmod 600 $RUNNER_TEMP/gcp-sa-key.json | |
| echo "GOOGLE_APPLICATION_CREDENTIALS=$RUNNER_TEMP/gcp-sa-key.json" >> $GITHUB_ENV | |
| env: | |
| GCP_SA_KEY_RAW: ${{ secrets.GCP_SA_KEY }} | |
| shell: bash | |
| - name: Install google-auth | |
| working-directory: ${{ github.workspace }} | |
| run: python3 -m pip install google-auth requests | |
| shell: bash | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - 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: Sign Nuget Package | |
| working-directory: ${{ github.workspace }} | |
| run: | | |
| chmod +x ./scripts/sign_nupkg.sh | |
| ./scripts/sign_nupkg.sh | |
| shell: bash | |
| - name: Save artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: BrowserStackLocal.nupkg | |
| path: .\BrowserStackLocal\BrowserStackLocal\bin\Release\*.nupkg | |
| - name: Push package to Nuget Repository | |
| working-directory: ${{ github.workspace }} | |
| run: dotnet nuget push BrowserStackLocal/BrowserStackLocal/bin/Release/*.nupkg --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json | |
| env: | |
| NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
| shell: bash | |
| - name: Cleanup credentials | |
| if: always() | |
| working-directory: ${{ github.workspace }} | |
| run: rm -f $RUNNER_TEMP/gcp-sa-key.json | |
| shell: bash |