Skip to content

Commit 24b77c4

Browse files
committed
add workflows
1 parent 07da0ab commit 24b77c4

File tree

5 files changed

+106
-8
lines changed

5 files changed

+106
-8
lines changed

.github/workflows/nuget-push-lagrange-core.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
# Check Version
2323
- shell: pwsh
2424
run: |
25-
$lversion = ([xml](Get-Content .\Lagrange.Core\Lagrange.Core.csproj)).Project.PropertyGroup.PackageVersion
25+
$lversion = ([xml](Get-Content .\Lagrange.Core\Lagrange.Core.csproj)).Project.PropertyGroup.Version
2626
echo "Local version: $lversion"
2727
2828
$response = Invoke-WebRequest -Uri "https://api.nuget.org/v3-flatcontainer/lagrange.core/index.json"
@@ -47,11 +47,5 @@ jobs:
4747
- if: env.continued == 'true'
4848
run: dotnet pack -c Release -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg Lagrange.Core
4949

50-
# - if: env.continued == 'true'
51-
# run: dotnet nuget add source --username LagrangeDev --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/LagrangeDev/index.json"
52-
53-
# - if: env.continued == 'true'
54-
# run: dotnet nuget push ./Lagrange.Core/bin/Release/*.nupkg --source "github" --api-key ${{ secrets.GITHUB_TOKEN }}
55-
5650
- if: env.continued == 'true'
5751
run: dotnet nuget push ./Lagrange.Core/bin/Release/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_TOKEN }}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Nuget push Lagrange.Proto.CodeGen
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "Lagrange.Proto.CodeGen/Lagrange.Proto.CodeGen.csproj"
9+
workflow_dispatch:
10+
11+
jobs:
12+
nuget-push:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/setup-dotnet@v4
17+
with:
18+
dotnet-version: '9'
19+
20+
- uses: actions/checkout@v4
21+
22+
# Check Version
23+
- shell: pwsh
24+
run: |
25+
$lversion = ([xml](Get-Content .\Lagrange.Proto.CodeGen\Lagrange.Proto.CodeGen.csproj)).Project.PropertyGroup.Version
26+
echo "Local version: $lversion"
27+
28+
$response = Invoke-WebRequest -Uri "https://api.nuget.org/v3-flatcontainer/lagrange.proto.codegen/index.json"
29+
if ($response.StatusCode -eq 404) {
30+
echo "No remote version"
31+
echo "continued=true" >> $env:GITHUB_ENV
32+
exit 0
33+
}
34+
35+
$rversions = ($response.Content | ConvertFrom-Json).versions
36+
echo "Remote version: $rversions"
37+
if ($lversion -in $rversions) {
38+
echo "Version($lversion) already exists"
39+
echo "continued=false" >> $env:GITHUB_ENV
40+
exit 0
41+
}
42+
43+
echo "Version($lversion) does not exist"
44+
echo "continued=true" >> $env:GITHUB_ENV
45+
exit 0
46+
47+
- if: env.continued == 'true'
48+
run: dotnet pack -c Release -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg Lagrange.Proto.CodeGen
49+
50+
- if: env.continued == 'true'
51+
run: dotnet nuget push ./Lagrange.Proto.CodeGen/bin/Release/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_TOKEN }}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Nuget push Lagrange.Proto
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "Lagrange.Proto/Lagrange.Proto.csproj"
9+
workflow_dispatch:
10+
11+
jobs:
12+
nuget-push:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/setup-dotnet@v4
17+
with:
18+
dotnet-version: '9'
19+
20+
- uses: actions/checkout@v4
21+
22+
# Check Version
23+
- shell: pwsh
24+
run: |
25+
$lversion = ([xml](Get-Content .\Lagrange.Proto\Lagrange.Proto.csproj)).Project.PropertyGroup.Version
26+
echo "Local version: $lversion"
27+
28+
$response = Invoke-WebRequest -Uri "https://api.nuget.org/v3-flatcontainer/lagrange.proto/index.json"
29+
if ($response.StatusCode -eq 404) {
30+
echo "No remote version"
31+
echo "continued=true" >> $env:GITHUB_ENV
32+
exit 0
33+
}
34+
35+
$rversions = ($response.Content | ConvertFrom-Json).versions
36+
echo "Remote version: $rversions"
37+
if ($lversion -in $rversions) {
38+
echo "Version($lversion) already exists"
39+
echo "continued=false" >> $env:GITHUB_ENV
40+
exit 0
41+
}
42+
43+
echo "Version($lversion) does not exist"
44+
echo "continued=true" >> $env:GITHUB_ENV
45+
exit 0
46+
47+
- if: env.continued == 'true'
48+
run: dotnet pack -c Release -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg Lagrange.Proto
49+
50+
- if: env.continued == 'true'
51+
run: dotnet nuget push ./Lagrange.Proto/bin/Release/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_TOKEN }}

Lagrange.Core/Lagrange.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<LangVersion>13</LangVersion>
88
<IsAotCompatible>true</IsAotCompatible>
99

10-
<PackageVersion>2.0.0-beta</PackageVersion>
10+
<Version>2.0.0-beta</Version>
1111
</PropertyGroup>
1212

1313
<ItemGroup>

Lagrange.Proto.CodeGen/Lagrange.Proto.CodeGen.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
<TrimMode>full</TrimMode>
1010
<PublishSingleFile>true</PublishSingleFile>
1111
<PublishTrimmed>true</PublishTrimmed>
12+
13+
<Version>0.0.1</Version>
1214
</PropertyGroup>
1315

1416
<ItemGroup>

0 commit comments

Comments
 (0)