44 push :
55 branches :
66 - main
7+ - master
78 paths :
89 - " Lagrange.Proto.Generator/Lagrange.Proto.Generator.csproj"
910 workflow_dispatch :
@@ -13,45 +14,17 @@ jobs:
1314 runs-on : ubuntu-latest
1415
1516 steps :
16- - uses : actions/checkout@v4
17-
18- # Check Version
19- - shell : pwsh
20- run : |
21- $lversion = ([xml](Get-Content .\Lagrange.Proto.Generator\Lagrange.Proto.Generator.csproj)).Project.PropertyGroup.Version
22- echo "Local version: $lversion"
23-
24- try {
25- $response = Invoke-WebRequest -Uri "https://api.nuget.org/v3-flatcontainer/lagrange.proto.generator/index.json"
26- } catch {
27- if ($_.Exception.Response.StatusCode.value__ -eq 404) {
28- echo "No remote version"
29- echo "continued=true" >> $env:GITHUB_ENV
30- exit 0
31- } else {
32- throw
33- }
34- }
35-
36- $rversions = ($response.Content | ConvertFrom-Json).versions
37- echo "Remote version: $rversions"
38- if ($lversion -in $rversions) {
39- echo "Version($lversion) already exists"
40- echo "continued=false" >> $env:GITHUB_ENV
41- exit 0
42- }
17+ - id : nuget-login
18+ uses : NuGet/login@v1
19+ with :
20+ user : Linwenxuan04
4321
44- echo "Version($lversion) does not exist"
45- echo "continued=true" >> $env:GITHUB_ENV
46- exit 0
22+ - uses : actions/checkout@v4
4723
48- - if : env.continued == 'true'
49- uses : actions/setup-dotnet@v4
24+ - uses : actions/setup-dotnet@v4
5025 with :
5126 dotnet-version : ' 10'
5227
53- - if : env.continued == 'true'
54- run : dotnet pack -c Release -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg Lagrange.Proto.Generator
28+ - run : dotnet pack -c Release -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg Lagrange.Proto.Generator
5529
56- - if : env.continued == 'true'
57- run : dotnet nuget push ./Lagrange.Proto.Generator/bin/Release/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_TOKEN }}
30+ - run : dotnet nuget push ./Lagrange.Proto.Generator/bin/Release/*.nupkg --source https://api.nuget.org/v3/index.json --skip-duplicate --api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY }}
0 commit comments