@@ -27,20 +27,52 @@ jobs:
27
27
run : |
28
28
dotnet test -c Release -f net8
29
29
30
- pushNuGetPackageToGitHubPackageRegistry :
31
- needs : test
32
- runs-on : ubuntu-latest
33
- steps :
34
- - uses : actions/checkout@v4
30
+ pushNuGetPackageToGitHubPackageRegistry :
31
+ needs : test
32
+ runs-on : ubuntu-latest
33
+ steps :
34
+ # 1. Checkout the repository
35
+ - uses : actions/checkout@v4
36
+ with :
37
+ submodules : true
38
+
39
+ # 2. Setup .NET SDK
40
+ - name : Setup .NET
41
+ uses : actions/setup-dotnet@v3
35
42
with :
36
- submodules : true
37
- - uses : nuget/setup-nuget@v1
38
- - name : Publish NuGet package to GitHub Package Registry
43
+ dotnet-version : ' 8.0.x' # Specify your required .NET version
44
+
45
+ # 3. Restore dependencies
46
+ - name : Restore dependencies
47
+ run : dotnet restore
48
+
49
+ # 4. Build the project
50
+ - name : Build
51
+ run : dotnet build --configuration Release --no-restore
52
+
53
+ # 5. Pack the project into a NuGet package
54
+ - name : Pack
55
+ run : dotnet pack --configuration Release --no-restore --output ./nupkgs
56
+
57
+ # 6. Add GitHub Package Registry as a NuGet source
58
+ - name : Add GitHub Package Registry as NuGet Source
59
+ run : |
60
+ dotnet nuget add source "https://nuget.pkg.github.com/linksplatform/index.json" \
61
+ --name "GitHub" \
62
+ --username "linksplatform" \
63
+ --password "${{ secrets.GITHUB_TOKEN }}" \
64
+ --store-password-in-clear-text
65
+ env :
66
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
67
+
68
+ # 7. Push the NuGet package to GitHub Package Registry
69
+ - name : Push NuGet Package to GitHub Package Registry
39
70
run : |
40
- dotnet build -c Release
41
- dotnet pack -c Release
42
- nuget source Add -Name "GitHub" -Source "https://nuget.pkg.github.com/linksplatform/index.json" -UserName linksplatform -Password ${{ secrets.GITHUB_TOKEN }}
43
- nuget push **/*.nupkg -Source "GitHub" -SkipDuplicate
71
+ dotnet nuget push ./nupkgs/*.nupkg \
72
+ --source "GitHub" \
73
+ --api-key "${{ secrets.GITHUB_TOKEN }}"
74
+ env :
75
+ NUGET_AUTH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
44
76
45
77
pusnToNuget :
46
78
runs-on : ubuntu-latest
0 commit comments