diff --git a/.github/workflows/build-and-push-nuget-packages.yml b/.github/workflows/build-and-push-nuget-packages.yml index a79a477..f59e58b 100644 --- a/.github/workflows/build-and-push-nuget-packages.yml +++ b/.github/workflows/build-and-push-nuget-packages.yml @@ -17,49 +17,21 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - - name: Work out last successful commit - id: setSHAs - uses: nrwl/nx-set-shas@v4 - - - name: Determine affected projects - id: dotnet_affected - run: | - dotnet new tool-manifest && dotnet tool install dotnet-affected - - if dotnet affected -f text traversal \ - --from "${{ steps.setSHAs.outputs.base }}" \ - --to "${{ github.sha }}"; then - if [ -s affected.txt ]; then - cat affected.txt - echo "Number of affected projects: " $(wc -l < affected.txt) - echo "has_output=true" >> $GITHUB_OUTPUT - else - echo "No affected projects." - echo "has_output=false" >> $GITHUB_OUTPUT - fi - elif [ $? -ne 166 ]; then - echo "Exiting, error occurred" - exit 1 - else - echo "No affected projects." - echo "has_output=false" >> $GITHUB_OUTPUT - fi - - - name: Test affected projects - if: steps.dotnet_affected.outputs.has_output == 'true' - run: dotnet test affected.proj - - - name: Pack affected projects - if: steps.dotnet_affected.outputs.has_output == 'true' + + - name: Restore dependencies + run: dotnet restore + + - name: Test projects + run: dotnet test + + - name: Pack projects run: | if [ "${{ github.ref_name }}" == "main" ]; then - dotnet pack affected.proj + dotnet pack --configuration Release else VERSION=$(date +"%Y.%m.%d.%H%M") - dotnet pack affected.proj /p:Version=${VERSION}-dev + dotnet pack --configuration Release /p:Version=${VERSION}-dev fi - + - name: Push NuGet packages - if: steps.dotnet_affected.outputs.has_output == 'true' run: dotnet nuget push **/Release/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json