Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSOE-176: Add package validation to NuGet publishing #49

Merged
merged 9 commits into from
Sep 8, 2022
12 changes: 7 additions & 5 deletions .github/actions/publish-nuget/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,25 +124,26 @@ runs:
# Notes on the configuration apart from what's also for dotnet build:
# * NoWarn on NU5104 to not have warnings for prerelease dependencies, see:
# https://docs.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu5104.
# * -p:WarnOnPackingNonPackableProject=True will cause a build warning (converted to error) if we try to pack
# a non-packagable project.
# * -p:WarnOnPackingNonPackableProject=True will cause a build warning (converted to error) if we try to pack a
# non-packagable project.
# * -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg are needed to generate symbol packages:
# https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg.
# * p:EnablePackageValidation=true is for package validation, see:
# https://docs.microsoft.com/en-us/dotnet/fundamentals/package-validation/overview.
run: |
if ([string]::IsNullOrWhiteSpace($Env:API_KEY)) {
Write-Output "::error::API_KEY is missing or empty."
exit 1
}

$noWarn = @('NU5104') + @'
$noWarn = @('NU5104%3BCS1573%3BCS1591%3BVSTHRD002%3BVSTHRD200') + @'
dministro marked this conversation as resolved.
Show resolved Hide resolved
${{ inputs.dotnet-pack-ignore-warning }}
'@.Split() | ? { $_ }

New-NuGetPackage @(
"--configuration:Release",
"--warnaserror",
"--no-restore",
"--no-build",
"--output:" + (Join-Path $PWD artifacts),
"--verbosity:${{ inputs.verbosity }}",
"-p:NuGetBuild=true",
Expand All @@ -154,7 +155,8 @@ runs:
"-p:WarnOnPackingNonPackableProject=True",
"-p:IncludeSymbols=${{ inputs.dotnet-pack-include-symbols }}",
"-p:SymbolPackageFormat=snupkg",
"-p:NoDefaultExcludes=true"
"-p:NoDefaultExcludes=true",
"-p:EnablePackageValidation=true"
dministro marked this conversation as resolved.
Show resolved Hide resolved
)

- name: Push with dotnet
Expand Down