From ad39447ff0c8670a681515bd09f9302026ae16ae Mon Sep 17 00:00:00 2001 From: Vitaly Bibikov Date: Tue, 16 Apr 2024 21:10:55 +0200 Subject: [PATCH] Update dotnet.yml --- .github/workflows/dotnet.yml | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 1596dff..53158ea 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -10,7 +10,15 @@ on: branches: [ "master", "development" ] pull_request: branches: [ "master", "development" ] - + release: + types: + - published # Run the workflow when a new GitHub release is published + +env: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + DOTNET_NOLOGO: true + NuGetDirectory: ${{github.workspace}}/nupkgs + jobs: integration-tests: runs-on: ubuntu-latest @@ -85,17 +93,25 @@ jobs: uses: actions/checkout@v3 - name: Setup .NET Core - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: dotnet-version: '8.0.x' - name: Build and Pack run: | dotnet build src/DynamoDBv2.Transactions.csproj --configuration Release - dotnet pack src/DynamoDBv2.Transactions.csproj --configuration Release --output ./nupkgs /p:Version=3.7.$GITHUB_RUN_NUMBER + dotnet pack src/DynamoDBv2.Transactions.csproj --configuration Release --output ${{ env.NuGetDirectory }} /p:Version=3.7.$GITHUB_RUN_NUMBER - - name: Publish NuGet Package - uses: rohith/publish-nuget@v2 + - name: Create NuGet Artifact + - uses: actions/upload-artifact@v3 with: - package_path: ./nupkgs/*.nupkg - nuget_key: ${{ secrets.NUGET_PUSH_KEY }} + name: nuget + if-no-files-found: error + retention-days: 7 + path: ${{ env.NuGetDirectory }}/*.nupkg + + - name: Publish NuGet package + run: | + foreach($file in (Get-ChildItem ${{ env.NuGetDirectory }} -Recurse -Include *.nupkg)) { + dotnet nuget push $file --api-key "${{ secrets.NUGET_PUSH_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate + }