From b0252dd7314c5a6bd7309e4b686b4aae14effbe7 Mon Sep 17 00:00:00 2001 From: ma575081 <91095107+ma575081@users.noreply.github.com> Date: Wed, 12 Jun 2024 10:45:43 -0500 Subject: [PATCH] chore: address nuget package health issues- symbols, etc. plus other pre-publish-hook refactoring --- .github/workflows/scripts/pre-publish-hook | 70 +++++++++++++++------- 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/.github/workflows/scripts/pre-publish-hook b/.github/workflows/scripts/pre-publish-hook index 8418fd0..7aa9251 100755 --- a/.github/workflows/scripts/pre-publish-hook +++ b/.github/workflows/scripts/pre-publish-hook @@ -10,23 +10,53 @@ sed -i "/^[[:blank:]]*Debug|Any CPU.*/d" $f # modify/remove a few generated parts f=Shippo/Shippo.csproj echo updating $f... -yq -i -o xml -p xml " - ( .Project.PropertyGroup.Copyright = \"Copyright (c) Shippo 2024\" - | .Project.PropertyGroup.Description = \".NET library which integrates with Shippo Multi Carrier Shipping API. This library provides access to Shippo ""(goshippo.com)"" API capabilities. Including label generation, rating, tracking and more.\" - | .Project.PropertyGroup.PackageIcon = \"shippo.png\" - | .Project.PropertyGroup.PackageLicenseFile = \"LICENSE\" - | .Project.PropertyGroup.PackageProjectUrl = \"https://github.com/goshippo/shippo-csharp-sdk\" - | .Project.PropertyGroup.PackageTags = \"USPS Fedex UPS API Shippo\" - | .Project.PropertyGroup.RepositoryType = \"git\" - | del( .Project.ItemGroup.None[] | select(.+@Include == \"..\\docs\\**\\*\") ) - | .Project.ItemGroup.None += { - \"+@Include\": \"..\\LICENSE\", - \"+@Pack\": \"true\", - \"+@PackagePath\": \"\\\\\" - } - | .Project.ItemGroup.None += { - \"+@Include\": \"..\\res\\shippo.png\", - \"+@Pack\": \"true\", - \"+@PackagePath\": \"\\\\\" - } - )" $f +condition="'\$(GITHUB_ACTIONS)' == 'true'" +yq -i -o xml -p xml ' + ( del( .Project.ItemGroup.None[] | select(.+@Include == "..\docs\**\*") ) + | .Project.PropertyGroup = [ + .Project.PropertyGroup, + [ + { + "+@Condition": "'"$condition"'", + "ContinuousIntegrationBuild": "true", + "EmbedUntrackedSources": "true", + "IncludeSymbols": "true", + "PublishRepositoryUrl": "true", + "SymbolPackageFormat": "snupkg" + }, + { + "Copyright": "Copyright (c) Shippo 2024", + "Description": ".NET library which integrates with Shippo Multi Carrier Shipping API. This library provides access to Shippo (goshippo.com) API capabilities. Including label generation, rating, tracking and more.", + "PackageLicenseFile": "LICENSE", + "PackageIcon": "shippo.png", + "PackageProjectUrl": "https://github.com/goshippo/shippo-csharp-sdk", + "PackageTags": "USPS Fedex UPS API Shippo", + "RepositoryType": "git" + } + ] + ] + | .Project.ItemGroup = [ + .Project.ItemGroup, + { + "None": [ + { + "+@Include": "..\LICENSE", + "+@Pack": "true", + "+@PackagePath": "\\" + }, + { + "+@Include": "..\res\shippo.png", + "+@Pack": "true", + "+@PackagePath": "\\" + } + ], + "PackageReference": { + "+@Include": "Microsoft.SourceLink.GitHub", + "+@PrivateAssets": "All", + "+@Version": "8.0.0" + } + } + ] + )' $f +# yq escapes single quotes; unescape them +sed -i "s|'|'|g" $f