@@ -19,50 +19,19 @@ jobs:
1919 with :
2020 dotnet-version : ' 8.0.x'
2121
22- - name : Install dependencies for version check
23- run : |
24- sudo apt-get update
25- sudo apt-get install -y libxml2-utils jq
26-
27- - name : Check if ShapeEngine version is new
28- id : check_version
29- run : |
30- csproj_version=$(xmllint --xpath "string(//Version)" ShapeEngine/ShapeEngine.csproj)
31- echo "ShapeEngine.csproj version: $csproj_version"
32- echo "csproj_version=$csproj_version" >> $GITHUB_OUTPUT
33-
34- nuget_versions=$(curl -s https://api.nuget.org/v3-flatcontainer/shapeengine/index.json | jq -r '.versions')
35- if [ "$nuget_versions" = "null" ]; then
36- echo "No versions found on NuGet. Proceeding with publish."
37- echo "should_publish=true" >> $GITHUB_OUTPUT
38- exit 0
39- fi
40- latest_nuget_version=$(echo "$nuget_versions" | jq -r '.[-1]')
41- echo "Latest NuGet version: $latest_nuget_version"
42- echo "nuget_version=$latest_nuget_version" >> $GITHUB_OUTPUT
43-
44- if [ "$csproj_version" = "$latest_nuget_version" ]; then
45- echo "Version $csproj_version is already published. Skipping publish."
46- echo "should_publish=false" >> $GITHUB_OUTPUT
47- else
48- echo "Version is new. Proceeding with publish."
49- echo "should_publish=true" >> $GITHUB_OUTPUT
50-
5122 - name : Restore dependencies
52- if : steps.check_version.outputs.should_publish == 'true'
5323 run : dotnet restore ShapeEngine/ShapeEngine.csproj
5424
5525 - name : Build ShapeEngine
56- if : steps.check_version.outputs.should_publish == 'true'
5726 run : dotnet build ShapeEngine/ShapeEngine.csproj --configuration Release --no-restore
5827
5928 - name : Pack ShapeEngine NuGet Package
60- if : steps.check_version.outputs.should_publish == 'true'
6129 run : dotnet pack ShapeEngine/ShapeEngine.csproj --configuration Release --no-build --output ./nupkgs
6230
6331 - name : Publish ShapeEngine NuGet Package
64- if : steps.check_version.outputs.should_publish == 'true'
6532 env :
6633 NUGET_API_KEY : ${{ secrets.NUGET_API_KEY }}
6734 run : |
68- dotnet nuget push ./nupkgs/ShapeEngine.*.nupkg --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json
35+ for pkg in ./nupkgs/*.nupkg; do
36+ dotnet nuget push "$pkg" --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json
37+ done
0 commit comments