Skip to content

Commit 7964147

Browse files
fix: workflow issue
1 parent a4f2bd1 commit 7964147

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

.github/workflows/publish.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,36 @@ on:
77

88
jobs:
99
build-and-publish:
10-
runs-on: ubuntu-latest
10+
runs-on: windows-latest # Changed to Windows for broader compatibility
11+
12+
strategy:
13+
matrix:
14+
configuration: [Release]
15+
framework: [net7.0, net9.0, .NETFramework4.8] # Target all frameworks
16+
1117
steps:
1218
- uses: actions/checkout@v3
1319

1420
- name: Setup .NET
1521
uses: actions/setup-dotnet@v3
1622
with:
17-
dotnet-version: "7.0.x" # Use a single version for publishing
23+
dotnet-version: ${{ matrix.framework }} # Use matrix value
1824

1925
- name: Restore dependencies
2026
run: dotnet restore NepDate.sln
2127

2228
- name: Build
23-
run: dotnet build NepDate.sln --configuration Release --no-restore
29+
run: dotnet build NepDate.sln --configuration ${{ matrix.configuration }} --framework ${{ matrix.framework }} --no-restore
2430

2531
- name: Test
26-
run: dotnet test NepDate.sln --configuration Release --no-build --verbosity normal
32+
run: dotnet test NepDate.sln --configuration ${{ matrix.configuration }} --framework ${{ matrix.framework }} --no-build --verbosity normal
2733

2834
- name: Pack
29-
run: dotnet pack src/NepDate/NepDate.csproj --configuration Release --no-build --output nupkgs
35+
run: dotnet pack src/NepDate/NepDate.csproj --configuration ${{ matrix.configuration }} --framework ${{ matrix.framework }} --no-build --output nupkgs
3036

3137
- name: Extract Version from Tag
3238
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
3339

3440
- name: Push to NuGet
35-
run: dotnet nuget push nupkgs/NepDate.${VERSION}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
41+
if: matrix.framework == 'net7.0' # Only push once
42+
run: dotnet nuget push nupkgs/NepDate.${VERSION}.${{ matrix.framework }}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate

.github/workflows/test.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,26 @@ on:
88

99
jobs:
1010
test:
11-
runs-on: ubuntu-latest
11+
runs-on: windows-latest # Changed to Windows
12+
13+
strategy:
14+
matrix:
15+
configuration: [Debug, Release]
16+
framework: [.NETFramework4.8, net7.0, net9.0] # Include .NET Framework and .NET versions
1217

1318
steps:
1419
- uses: actions/checkout@v3
1520

1621
- name: Setup .NET
1722
uses: actions/setup-dotnet@v3
1823
with:
19-
dotnet-version: "7.0.x"
24+
dotnet-version: ${{ matrix.framework }} # Use matrix to specify .NET version
2025

2126
- name: Restore dependencies
2227
run: dotnet restore NepDate.sln
2328

2429
- name: Build
25-
run: dotnet build NepDate.sln --no-restore
30+
run: dotnet build NepDate.sln --configuration ${{ matrix.configuration }} --framework ${{ matrix.framework }} --no-restore
2631

2732
- name: Test
28-
run: dotnet test NepDate.sln --no-build --verbosity normal
33+
run: dotnet test NepDate.sln --configuration ${{ matrix.configuration }} --framework ${{ matrix.framework }} --no-build --verbosity normal

0 commit comments

Comments
 (0)