Skip to content

Commit

Permalink
New form to set the TFM in CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
tsutomi committed Feb 26, 2024
1 parent 33efe09 commit 8e23ff5
Showing 1 changed file with 32 additions and 18 deletions.
50 changes: 32 additions & 18 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,43 @@ jobs:
with:
dotnet-version: ${{ matrix.dotnet }}

- name: Set the TFM for .NET 6.0 in Ubuntu
if: matrix.dotnet == '6.0.x' && startsWith(matrix.os, 'ubuntu')
run: echo "DOTNET_TFM=net6.0" >> $GITHUB_ENV
- name: Set the TFM in Ubuntu
if: startsWith(matrix.os, 'ubuntu')
run: |
VERSION=$(echo "${{ matrix.dotnet }}" | sed 's/[^0-9.]*//g')
DOTNET_TFM=".net${VERSION}"
echo "DOTNET_TFM=$DOTNET_TFM" >> $GITHUB_ENV
- name: Set the TFM for .NET 6.0 in Windows
if: matrix.dotnet == '6.0.x' && startsWith(matrix.os, 'windows')
run: echo "DOTNET_TFM=net6.0" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Set the TFM in Windows
if: startsWith(matrix.os, 'windows')
run: |
$VERSION = ${{ matrix.dotnet }} -replace '[^0-9.]', ''
$DOTNET_TFM = ".net$VERSION"
echo "DOTNET_TFM=$DOTNET_TFM" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Set the TFM for .NET 7.0 in Ubuntu
if: matrix.dotnet == '7.0.x' && startsWith(matrix.os, 'ubuntu')
run: echo "DOTNET_TFM=net7.0" >> $GITHUB_ENV
# - name: Set the TFM for .NET 6.0 in Ubuntu
# if: matrix.dotnet == '6.0.x' && startsWith(matrix.os, 'ubuntu')
# run: echo "DOTNET_TFM=net6.0" >> $GITHUB_ENV

- name: Set the TFM for .NET 7.0 in Windows
if: matrix.dotnet == '7.0.x' && startsWith(matrix.os, 'windows')
run: echo "DOTNET_TFM=net7.0" | Out-File -FilePath $env:GITHUB_ENV -Append
# - name: Set the TFM for .NET 6.0 in Windows
# if: matrix.dotnet == '6.0.x' && startsWith(matrix.os, 'windows')
# run: echo "DOTNET_TFM=net6.0" | Out-File -FilePath $env:GITHUB_ENV -Append

- name: Set the TFM for .NET 8.0 in Ubuntu
if: matrix.dotnet == '8.0.x' && startsWith(matrix.os, 'ubuntu')
run: echo "DOTNET_TFM=net8.0" >> $GITHUB_ENV
# - name: Set the TFM for .NET 7.0 in Ubuntu
# if: matrix.dotnet == '7.0.x' && startsWith(matrix.os, 'ubuntu')
# run: echo "DOTNET_TFM=net7.0" >> $GITHUB_ENV

- name: Set the TFM for .NET 8.0 in Windows
if: matrix.dotnet == '8.0.x' && startsWith(matrix.os, 'windows')
run: echo "DOTNET_TFM=net8.0" | Out-File -FilePath $env:GITHUB_ENV -Append
# - name: Set the TFM for .NET 7.0 in Windows
# if: matrix.dotnet == '7.0.x' && startsWith(matrix.os, 'windows')
# run: echo "DOTNET_TFM=net7.0" | Out-File -FilePath $env:GITHUB_ENV -Append

# - name: Set the TFM for .NET 8.0 in Ubuntu
# if: matrix.dotnet == '8.0.x' && startsWith(matrix.os, 'ubuntu')
# run: echo "DOTNET_TFM=net8.0" >> $GITHUB_ENV

# - name: Set the TFM for .NET 8.0 in Windows
# if: matrix.dotnet == '8.0.x' && startsWith(matrix.os, 'windows')
# run: echo "DOTNET_TFM=net8.0" | Out-File -FilePath $env:GITHUB_ENV -Append

- name: Restore dependencies
run: dotnet restore
Expand Down

0 comments on commit 8e23ff5

Please sign in to comment.