Skip to content

Commit 505edf7

Browse files
committed
Update GitHub Action
1 parent 023ecb7 commit 505edf7

File tree

1 file changed

+32
-19
lines changed

1 file changed

+32
-19
lines changed

.github/workflows/dotnet.yml

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,51 @@ jobs:
1010

1111
build:
1212

13-
strategy:
14-
matrix:
15-
configuration: [Release]
16-
1713
runs-on: windows-latest
1814

1915
env:
20-
Solution_Name: Flow.Launcher.Localization.slnx
21-
Test_Project_Path: Flow.Launcher.Localization\Flow.Launcher.Localization.csproj
16+
Dotnet_Version: 8.0.x
17+
Project_Path: Flow.Launcher.Localization\Flow.Launcher.Localization.csproj
18+
NuGet_Source: 'https://api.nuget.org/v3/index.json'
2219

2320
steps:
21+
22+
# Checkout codes
2423
- name: Checkout
2524
uses: actions/checkout@v4
26-
with:
27-
fetch-depth: 0
2825

2926
# Install the .NET Core workload
30-
- name: Install .NET Core
27+
- name: Setup .NET
3128
uses: actions/setup-dotnet@v4
3229
with:
33-
dotnet-version: 7.0.x
30+
dotnet-version: ${{ env.Dotnet_Version }}
3431

35-
# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
36-
- name: Setup MSBuild.exe
37-
uses: microsoft/setup-msbuild@v2
32+
# Restore dependencies
33+
- name: Restore dependencies
34+
run: dotnet restore ${{ env.Project_Path }}
35+
36+
# Build the project
37+
- name: Build
38+
run: dotnet build ${{ env.Project_Path }} --configuration Release --no-restore
3839

3940
# Execute all unit tests in the solution
4041
- name: Execute unit tests
41-
run: dotnet test
42+
run: dotnet test --configuration Release --no-build
43+
44+
# Pack the NuGet package
45+
- name: Create NuGet package
46+
run: dotnet pack ${{ env.PROJECT_PATH }} --configuration Release --no-build --output nupkgs
4247

43-
# Restore the application to populate the obj folder with RuntimeIdentifiers
44-
- name: Restore the application
45-
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration
46-
env:
47-
Configuration: ${{ matrix.configuration }}
48+
# Upload the NuGet package
49+
- name: Upload NuGet package
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: Full nupkg
53+
path: |
54+
Flow.Launcher.Localization\bin\Release\Flow.Launcher.Localization.*.nupkg
55+
compression-level: 0
56+
57+
# Publish to NuGet.org
58+
# - name: Publish to NuGet
59+
# if: github.event_name == 'push' && github.ref == 'refs/heads/main' # Only publish on push to main
60+
# run: dotnet nuget push ./nupkgs/*.nupkg --source ${{ env.NuGet_Source }} --api-key ${{ secrets.NUGET_API_KEY }}

0 commit comments

Comments
 (0)