Skip to content

Commit

Permalink
Setting .NET Framework Moniker in PR workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
tsutomi committed Sep 1, 2024
1 parent 020b7d2 commit 93bb6fb
Showing 1 changed file with 36 additions and 9 deletions.
45 changes: 36 additions & 9 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 93bb6fb

Please sign in to comment.