Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
run: ./build.ps1
env:
NuGetApiKey: ${{ secrets.NUGETAPIKEY }}
GitHubApiKey: ${{ secrets.GITHUB_TOKEN }}

- name: Check for 'lcov.info' existence
id: check_files
Expand Down
8 changes: 7 additions & 1 deletion .nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"Pack",
"Push",
"Restore",
"RunTests"
"RunTests",
"ScanPackages"
]
},
"Verbosity": {
Expand Down Expand Up @@ -114,6 +115,11 @@
"Release"
]
},
"GitHubApiKey": {
"type": "string",
"description": "The key to use for scanning packages on GitHub",
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
},
"NuGetApiKey": {
"type": "string",
"description": "The key to push to Nuget",
Expand Down
Binary file added .packageguard/cache.bin
Binary file not shown.
16 changes: 16 additions & 0 deletions .packageguard/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"Settings": {
"Allow": {
"Licenses": [
"MIT",
"Apache-2.0",
"BSD-3-Clause",
"BSD-2-Clause"
],
"Packages": [
"FluentAssertions",
"NETStandard.Library"
]
}
}
}
16 changes: 16 additions & 0 deletions Build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class Build : NukeBuild
[Secret]
readonly string NuGetApiKey;

[Parameter("The key to use for scanning packages on GitHub")]
[Secret]
readonly string GitHubApiKey;

[Solution]
readonly Solution Solution;

Expand All @@ -48,6 +52,9 @@ class Build : NukeBuild

string SemVer;

[NuGetPackage("PackageGuard", "PackageGuard.dll")]
Tool PackageGuard;

Target CalculateNugetVersion => _ => _
.Executes(() =>
{
Expand Down Expand Up @@ -144,10 +151,19 @@ class Build : NukeBuild
Information($"Code coverage report: \x1b]8;;file://{link.Replace('\\', '/')}\x1b\\{link}\x1b]8;;\x1b\\");
});

Target ScanPackages => _ => _
.DependsOn(Compile)
.Executes(() =>
{
Environment.SetEnvironmentVariable("GITHUB_API_KEY", GitHubApiKey);
PackageGuard($"--config-path={RootDirectory / ".packageguard" / "config.json"} --use-caching {RootDirectory}");
});

Target Pack => _ => _
.DependsOn(CalculateNugetVersion)
.DependsOn(ApiChecks)
.DependsOn(CodeCoverage)
.DependsOn(ScanPackages)
.Executes(() =>
{
ReportSummary(s => s
Expand Down
1 change: 1 addition & 0 deletions Build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<PackageReference Include="Nuke.Components" Version="9.0.4" />
<PackageDownload Include="ReportGenerator" Version="[5.2.0]" />
<PackageDownload Include="GitVersion.Tool" Version="[6.0.2]" />
<PackageDownload Include="PackageGuard" Version="[1.4.1]" />
</ItemGroup>

</Project>