|
| 1 | +name: Publish NuGet Packages |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + package-name: |
| 7 | + description: 'Package to Publish (utils/selenium)' |
| 8 | + required: true |
| 9 | + type: choice |
| 10 | + options: |
| 11 | + - lambdatest-sdk-utils |
| 12 | + - lambdatest-selenium-driver |
| 13 | + default: 'lambdatest-sdk-utils' |
| 14 | + |
| 15 | +jobs: |
| 16 | + build-and-publish: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Checkout code |
| 21 | + uses: actions/checkout@v3 |
| 22 | + |
| 23 | + - name: Setup .NET |
| 24 | + uses: actions/setup-dotnet@v3 |
| 25 | + with: |
| 26 | + dotnet-version: '8.x' |
| 27 | + |
| 28 | + - name: Build and publish LambdaTest.Sdk.Utils |
| 29 | + if: github.event.inputs.package-name == 'lambdatest-sdk-utils' |
| 30 | + run: | |
| 31 | + dotnet restore ./LambdaTest.Sdk.Utils |
| 32 | + dotnet build ./LambdaTest.Sdk.Utils --configuration Release --no-restore |
| 33 | + dotnet pack ./LambdaTest.Sdk.Utils --configuration Release --no-build --output ./LambdaTest.Sdk.Utils/nupkgs |
| 34 | + dotnet nuget push ./LambdaTest.Sdk.Utils/nupkgs/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} |
| 35 | +
|
| 36 | + - name: Build and publish LambdaTest.Selenium.Driver |
| 37 | + if: github.event.inputs.package-name == 'lambdatest-selenium-driver' |
| 38 | + run: | |
| 39 | + # Build and pack LambdaTest.Sdk.Utils first |
| 40 | + dotnet restore ./LambdaTest.Sdk.Utils |
| 41 | + dotnet build ./LambdaTest.Sdk.Utils --configuration Release --no-restore |
| 42 | + dotnet pack ./LambdaTest.Sdk.Utils --configuration Release --no-build --output ./LambdaTest.Sdk.Utils/nupkgs |
| 43 | +
|
| 44 | + # Install the locally built LambdaTest.Sdk.Utils package in LambdaTest.Selenium.Driver |
| 45 | + dotnet add ./LambdaTest.Selenium.Driver package LambdaTest.Sdk.Utils --source ./LambdaTest.Sdk.Utils/nupkgs |
| 46 | +
|
| 47 | + # Build and pack LambdaTest.Selenium.Driver |
| 48 | + dotnet restore ./LambdaTest.Selenium.Driver |
| 49 | + dotnet build ./LambdaTest.Selenium.Driver --configuration Release --no-restore |
| 50 | + dotnet pack ./LambdaTest.Selenium.Driver --configuration Release --no-build --output ./LambdaTest.Selenium.Driver/nupkgs |
| 51 | + dotnet nuget push ./LambdaTest.Selenium.Driver/nupkgs/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} |
0 commit comments