File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,14 +46,39 @@ jobs:
4646 committer_name : GitHub Actions
4747 committer_email : actions@github.com
4848
49- - name : Publish Beta
49+ publish :
50+ name : Publish NuGet package
51+ needs : build
52+ if : github.event_name == 'push' && (github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/stable')
53+ runs-on : windows-latest
54+ environment : nuget-publish
55+ permissions :
56+ contents : read
57+ id-token : write
58+ steps :
59+ - uses : actions/checkout@v4
60+
61+ - name : Setup .NET
62+ uses : actions/setup-dotnet@v4
63+ with :
64+ dotnet-version : ' 10.0.x'
65+
66+ - name : Pack Beta
5067 if : github.ref == 'refs/heads/beta'
51- run : |
52- dotnet pack src/Advanced.Algorithms/Advanced.Algorithms.csproj --version-suffix "beta"
53- dotnet nuget push **/*.nupkg -s "nuget" -k "${{ secrets.NUGET_TOKEN }}"
68+ run : dotnet pack src/Advanced.Algorithms/Advanced.Algorithms.csproj --version-suffix "beta" --output artifacts
5469
55- - name : Publish Stable
70+ - name : Pack Stable
5671 if : github.ref == 'refs/heads/stable'
72+ run : dotnet pack src/Advanced.Algorithms/Advanced.Algorithms.csproj --output artifacts
73+
74+ - name : NuGet login
75+ id : login
76+ uses : NuGet/login@v1
77+ with :
78+ user : ${{ secrets.NUGET_USER }}
79+
80+ - name : Publish package
5781 run : |
58- dotnet pack src/Advanced.Algorithms/Advanced.Algorithms.csproj
59- dotnet nuget push **/*.nupkg -s "nuget" -k "${{ secrets.NUGET_TOKEN }}"
82+ $package = Get-ChildItem artifacts -Filter *.nupkg | Select-Object -First 1
83+ if (-not $package) { throw "No NuGet package was produced." }
84+ dotnet nuget push $package.FullName --source "nuget" --api-key "${{ steps.login.outputs.NUGET_API_KEY }}"
Original file line number Diff line number Diff line change 99 <DelaySign >False</DelaySign >
1010 <AllowUnsafeBlocks >True</AllowUnsafeBlocks >
1111 <LangVersion >latest</LangVersion >
12- <VersionPrefix >1.0.0.0 </VersionPrefix >
12+ <VersionPrefix >1.0.1 </VersionPrefix >
1313 </PropertyGroup >
1414
1515 <ItemGroup >
You can’t perform that action at this time.
0 commit comments