From 93bb6fbf8466b1a77410349f6feb3d9620c344e6 Mon Sep 17 00:00:00 2001 From: Antonello Provenzano Date: Sun, 1 Sep 2024 09:07:48 +0200 Subject: [PATCH] Setting .NET Framework Moniker in PR workflow --- .github/workflows/pr.yml | 45 ++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index ff3bfcd..5e36ca1 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -27,17 +27,44 @@ jobs: with: dotnet-version: ${{ matrix.dotnet }} - - name: Set the TFM for .NET 6.0 - if: matrix.dotnet == '6.0.x' - run: echo "DOTNET_TFM=net6.0" >> $GITHUB_ENV + # - name: Set the TFM for .NET 6.0 (Ubuntu) + # if: matrix.dotnet == '6.0.x' && matrix.os == 'ubuntu-latest' + # run: echo "DOTNET_TFM=net6.0" >> $GITHUB_ENV - - name: Set the TFM for .NET 7.0 - if: matrix.dotnet == '7.0.x' - run: echo "DOTNET_TFM=net7.0" >> $GITHUB_ENV + # - name: Set the TFM for .NET 7.0 (Ubuntu) + # if: matrix.dotnet == '7.0.x' && matrix.os == 'ubuntu-latest' + # run: echo "DOTNET_TFM=net7.0" >> $GITHUB_ENV - - name: Set the TFM for .NET 8.0 - if: matrix.dotnet == '8.0.x' - run: echo "DOTNET_TFM=net8.0" >> $GITHUB_ENV + # - name: Set the TFM for .NET 8.0 (Ubuntu) + # if: matrix.dotnet == '8.0.x' && matrix.os == 'ubuntu-latest' + # run: echo "DOTNET_TFM=net8.0" >> $GITHUB_ENV + + # - name: Set the TFM for .NET 6.0 (Windows) + # if: matrix.dotnet == '6.0.x' && matrix.os == 'windows-latest' + # run: echo "DOTNET_TFM=net6.0" >> $env:GITHUB_ENV + + # - name: Set the TFM for .NET 7.0 (Windows) + # if: matrix.dotnet == '7.0.x' && matrix.os == 'windows-latest' + # run: echo "DOTNET_TFM=net7.0" >> $env:GITHUB_ENV + + # - name: Set the TFM for .NET 8.0 (Windows) + # if: matrix.dotnet == '8.0.x' && matrix.os == 'windows-latest' + # run: echo "DOTNET_TFM=net8.0" >> $env:GITHUB_ENV + + - name: Set the TFM in Ubuntu + if: startsWith(matrix.os, 'ubuntu') + run: | + VERSION=$(echo "${{ matrix.dotnet }}" | sed 's/[^0-9.]*//g') + VERSION=$(echo "${VERSION}" | sed 's/\.$//') + DOTNET_TFM="net${VERSION}" + echo "DOTNET_TFM=$DOTNET_TFM" >> $GITHUB_ENV + + - name: Set the TFM in Windows + if: startsWith(matrix.os, 'windows') + run: | + $VERSION = "${{ matrix.dotnet }}".Substring(0, "${{ matrix.dotnet }}".LastIndexOf('.')) + $DOTNET_TFM = "net$VERSION" + echo "DOTNET_TFM=$DOTNET_TFM" | Out-File -FilePath $env:GITHUB_ENV -Append - name: Restore dependencies run: dotnet restore