Skip to content

Commit 6493096

Browse files
committed
Add GitHub Action
1 parent c342c78 commit 6493096

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

.github/workflows/dotnet.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: .NET Core Desktop
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ "main" ]
7+
pull_request:
8+
9+
jobs:
10+
11+
build:
12+
13+
runs-on: windows-latest
14+
15+
env:
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'
19+
20+
steps:
21+
22+
# Checkout codes
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
# Install the .NET Core workload
27+
- name: Setup .NET
28+
uses: actions/setup-dotnet@v4
29+
with:
30+
dotnet-version: ${{ env.Dotnet_Version }}
31+
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
39+
40+
# Execute all unit tests in the solution
41+
- name: Execute unit tests
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
47+
48+
# Upload the NuGet package
49+
- name: Upload NuGet package
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: Full nupkg
53+
path: nupkgs\Flow.Launcher.Localization.*.nupkg
54+
compression-level: 0
55+
56+
# Publish to NuGet.org
57+
# - name: Publish to NuGet
58+
# if: github.event_name == 'push' && github.ref == 'refs/heads/main' # Only publish on push to main
59+
# run: dotnet nuget push ./nupkgs/*.nupkg --source ${{ env.NuGet_Source }} --api-key ${{ secrets.NUGET_API_KEY }}

0 commit comments

Comments
 (0)