@@ -3,38 +3,46 @@ name: Publish NuGet Package
33on :
44 push :
55 tags :
6- - ' v*' # e.g. v1.0.0, v2.1 .3
6+ - ' v*' # e.g., v1.0.0, v1.2 .3
77
88jobs :
99 build :
10- runs-on : ubuntu-latest # ✅ use Ubuntu 20.04 for .NET 5 support
10+ runs-on : ubuntu-latest
1111
1212 steps :
13+ # 1. Checkout repository
1314 - name : Checkout code
1415 uses : actions/checkout@v4
1516
17+ # 2. Install .NET 6 SDK
1618 - name : Setup .NET
1719 uses : actions/setup-dotnet@v4
1820 with :
1921 dotnet-version : ' 6.0.x'
2022
23+ # 3. Extract version number from Git tag
2124 - name : Extract version from tag
2225 id : get_version
2326 run : |
2427 VERSION=${GITHUB_REF#refs/tags/v}
2528 echo "PACKAGE_VERSION=$VERSION" >> $GITHUB_ENV
2629
27- - name : Restore dependencies
28- run : dotnet restore
30+ # 4. Restore dependencies for the library
31+ - name : Restore library dependencies
32+ run : dotnet restore src/Keymapp.NET/Keymapp.NET.csproj
2933
30- - name : Build project
31- run : dotnet build --configuration Release --no-restore
34+ # 5. Build the library
35+ - name : Build library
36+ run : dotnet build src/Keymapp.NET/Keymapp.NET.csproj --configuration Release --no-restore
3237
38+ # 6. Run tests (pointing to your test project)
3339 - name : Run tests
34- run : dotnet test --configuration Release --no-build
40+ run : dotnet test tests/Keymapp.NET.Tests.Integration/Keymapp.NET.Tests.Integration.csproj --configuration Release --no-build
3541
42+ # 7. Pack the NuGet package
3643 - name : Pack NuGet package
37- run : dotnet pack --configuration Release --no-build -o ./artifacts /p:PackageVersion=${{ env.PACKAGE_VERSION }}
44+ run : dotnet pack src/Keymapp.NET/Keymapp.NET.csproj --configuration Release --no-build -o ./artifacts /p:PackageVersion=${{ env.PACKAGE_VERSION }}
3845
46+ # 8. Publish package to nuget.org
3947 - name : Publish NuGet package
40- run : dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
48+ run : dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
0 commit comments