-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathnuget-push-lagrange-proto-codegen.yaml
More file actions
57 lines (47 loc) · 1.76 KB
/
nuget-push-lagrange-proto-codegen.yaml
File metadata and controls
57 lines (47 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Nuget push Lagrange.Proto.Generator
on:
push:
branches:
- main
paths:
- "Lagrange.Proto.Generator/Lagrange.Proto.Generator.csproj"
workflow_dispatch:
jobs:
nuget-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Check Version
- shell: pwsh
run: |
$lversion = ([xml](Get-Content .\Lagrange.Proto.Generator\Lagrange.Proto.Generator.csproj)).Project.PropertyGroup.Version
echo "Local version: $lversion"
try {
$response = Invoke-WebRequest -Uri "https://api.nuget.org/v3-flatcontainer/lagrange.proto.generator/index.json"
} catch {
if ($_.Exception.Response.StatusCode.value__ -eq 404) {
echo "No remote version"
echo "continued=true" >> $env:GITHUB_ENV
exit 0
} else {
throw
}
}
$rversions = ($response.Content | ConvertFrom-Json).versions
echo "Remote version: $rversions"
if ($lversion -in $rversions) {
echo "Version($lversion) already exists"
echo "continued=false" >> $env:GITHUB_ENV
exit 0
}
echo "Version($lversion) does not exist"
echo "continued=true" >> $env:GITHUB_ENV
exit 0
- if: env.continued == 'true'
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10'
- if: env.continued == 'true'
run: dotnet pack -c Release -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg Lagrange.Proto.Generator
- if: env.continued == 'true'
run: dotnet nuget push ./Lagrange.Proto.Generator/bin/Release/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_TOKEN }}