Skip to content

Commit 9de7eff

Browse files
authored
Merge branch 'main' into dependabot/github_actions/actions/checkout-4.2.2
Signed-off-by: Patrick Dwyer <[email protected]>
2 parents ab05986 + df96070 commit 9de7eff

24 files changed

+117
-124
lines changed

.github/workflows/dotnetcore.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on: [pull_request, workflow_dispatch]
66
env:
77
SNAPSHOOTER_STRICT_MODE: true
88

9+
# see https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
10+
permissions: {}
11+
912
jobs:
1013
# Fail if there are build warnings
1114
#
@@ -14,37 +17,37 @@ jobs:
1417
# This can be done by running `dotnet clean` before running `dotnet build`
1518
build-warnings:
1619
name: Build warnings check
17-
runs-on: ubuntu-20.04
20+
runs-on: ubuntu-24.04
1821
timeout-minutes: 30
1922
steps:
2023
- uses: actions/[email protected]
21-
- uses: actions/setup-dotnet@v3.0.2
24+
- uses: actions/setup-dotnet@v4.3.1
2225
with:
23-
dotnet-version: '6.0'
26+
dotnet-version: '8.0'
2427

2528
- name: Build
2629
run: dotnet build /WarnAsError
2730

2831
# We end up targeting a range of runtimes, make sure they all build
2932
build:
3033
name: Runtime build check
31-
runs-on: ubuntu-20.04
34+
runs-on: ubuntu-24.04
3235
strategy:
3336
matrix:
34-
runtime: [linux-x64, linux-musl-x64, linux-arm, linux-arm64, win-x64, win-x86, win-arm, win-arm64, osx-x64, osx-arm64]
37+
runtime: [linux-x64, linux-musl-x64, linux-arm, linux-arm64, win-x64, win-x86, win-arm64, osx-x64, osx-arm64]
3538
timeout-minutes: 30
3639
steps:
3740
- uses: actions/[email protected]
38-
- uses: actions/setup-dotnet@v3.0.2
41+
- uses: actions/setup-dotnet@v4.3.1
3942
with:
40-
dotnet-version: '6.0'
43+
dotnet-version: '8.0'
4144

4245
- name: Build
4346
run: dotnet build src/cyclonedx/cyclonedx.csproj -r ${{ matrix.runtime }}
4447

4548
# Fail if there are any failed tests
4649
#
47-
# We support .NET 6.0 on Windows, Mac and Linux.
50+
# We support .NET 8.0 on Windows, Mac and Linux.
4851
#
4952
# To check for failing tests locally run `dotnet test`.
5053
test:
@@ -59,9 +62,9 @@ jobs:
5962

6063
steps:
6164
- uses: actions/[email protected]
62-
- uses: actions/setup-dotnet@v3.0.2
65+
- uses: actions/setup-dotnet@v4.3.1
6366
with:
64-
dotnet-version: '6.0'
67+
dotnet-version: '8.0'
6568

6669
- name: SnapshooterHotfixSymlinkLinux
6770
if: matrix.os == 'ubuntu-latest'
@@ -75,4 +78,4 @@ jobs:
7578
- name: Tests
7679
run: |
7780
dotnet restore
78-
dotnet test --framework net6.0
81+
dotnet test --framework net8.0

.github/workflows/release.yml

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,25 @@ on:
2525
env:
2626
SNAPSHOOTER_STRICT_MODE: true
2727

28+
# see https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
29+
permissions: {}
30+
2831
jobs:
2932
release:
3033
name: Release
31-
runs-on: ubuntu-20.04
34+
permissions:
35+
contents: write # for git-push and creating a GH release and uploading release assets
36+
runs-on: ubuntu-24.04
3237
timeout-minutes: 30
3338
outputs:
3439
# Used by the release-osx-arm64 job to upload the osx-arm64 binary
3540
release_upload_url: ${{ steps.create_release.outputs.upload_url }}
3641
steps:
3742
- uses: actions/[email protected]
38-
- uses: actions/[email protected]
43+
- uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 #v3.11.1
44+
- uses: actions/[email protected]
3945
with:
40-
dotnet-version: '6.0'
46+
dotnet-version: '8.0'
4147
- name: SnapshooterHotfixSymlinkLinux
4248
run: sudo ln -s "$GITHUB_WORKSPACE" /_
4349
shell: bash
@@ -47,27 +53,34 @@ jobs:
4753

4854
# Create binaries
4955
- name: Create binaries
56+
env:
57+
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
5058
id: create_binaries
5159
run: |
5260
VERSION=`cat semver.txt`
5361
echo "##[set-output name=version;]$VERSION"
5462
REPO=cyclonedx/cyclonedx-cli
5563
dotnet build --configuration Release
5664
mkdir bin
57-
for runtime in linux-x64 linux-musl-x64 linux-arm linux-arm64 win-x64 win-x86 win-arm win-arm64 osx-x64
65+
for runtime in linux-x64 linux-musl-x64 linux-arm linux-arm64 win-x64 win-x86 win-arm64 osx-x64
5866
do
5967
dotnet publish src/cyclonedx/cyclonedx.csproj -r $runtime --configuration Release /p:Version=$VERSION --self-contained true /p:PublishSingleFile=true /p:IncludeNativeLibrariesInSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true --output bin/$runtime
6068
done
61-
docker build -f Dockerfile --build-arg VERSION=$VERSION -t $REPO:$VERSION -t $REPO:latest .
62-
63-
- name: Publish Docker image to Docker Hub
64-
env:
65-
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
66-
run: |
67-
REPO=cyclonedx/cyclonedx-cli
69+
6870
docker login --username coderpatros --password "$DOCKER_TOKEN"
69-
docker push $REPO:latest
70-
docker push $REPO:${{ steps.create_binaries.outputs.version }}
71+
docker buildx build \
72+
--sbom=true \
73+
--provenance mode=max,builder-id="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \
74+
--annotation "org.opencontainers.image.url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \
75+
--annotation "org.opencontainers.image.source=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \
76+
--annotation "org.opencontainers.image.version=$VERSION" \
77+
--annotation "org.opencontainers.image.revision=$GITHUB_SHA" \
78+
--annotation "org.opencontainers.image.created=$(date -Iseconds)" \
79+
--build-arg VERSION=$VERSION \
80+
-t $REPO:$VERSION \
81+
-t $REPO:latest \
82+
--push \
83+
-f Dockerfile .
7184
7285
- name: Create github release and git tag for release
7386
id: create_release
@@ -140,16 +153,6 @@ jobs:
140153
asset_name: cyclonedx-win-x86.exe
141154
asset_content_type: application/octet-stream
142155

143-
- name: Upload binary to github release
144-
uses: actions/[email protected]
145-
env:
146-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
147-
with:
148-
upload_url: ${{ steps.create_release.outputs.upload_url }}
149-
asset_path: bin/win-arm/cyclonedx.exe
150-
asset_name: cyclonedx-win-arm.exe
151-
asset_content_type: application/octet-stream
152-
153156
- name: Upload binary to github release
154157
uses: actions/[email protected]
155158
env:
@@ -175,13 +178,15 @@ jobs:
175178
release-osx-arm64:
176179
name: Release osx-arm64
177180
needs: release
181+
permissions:
182+
contents: write # for uploading release assets
178183
runs-on: macos-latest
179184
timeout-minutes: 30
180185
steps:
181186
- uses: actions/[email protected]
182-
- uses: actions/setup-dotnet@v3.0.2
187+
- uses: actions/setup-dotnet@v4.3.1
183188
with:
184-
dotnet-version: '6.0'
189+
dotnet-version: '8.0'
185190

186191
- name: Create binary
187192
run: |
@@ -204,4 +209,4 @@ jobs:
204209
upload_url: ${{ needs.release.outputs.release_upload_url }}
205210
asset_path: bin/osx-arm64/cyclonedx
206211
asset_name: cyclonedx-osx-arm64
207-
asset_content_type: application/octet-stream
212+
asset_content_type: application/octet-stream

Dockerfile

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM mcr.microsoft.com/dotnet/runtime-deps:6.0
1+
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0
22

33
ENV PATH=/:$PATH
44

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ Officially supported builds are available for these platforms:
333333
Community supported builds are available for these platforms:
334334

335335
- Windows x86 (win-x86)
336-
- Windows ARM (win-arm)
337336
- Windows ARM x64 (win-arm64)
338337
- Linux ARM (linux-arm)
339338
- Linux ARM x64 (linux-arm64)
@@ -388,7 +387,7 @@ Permission to modify and redistribute is granted under the terms of the Apache 2
388387
Pull requests are welcome. But please read the
389388
[CycloneDX contributing guidelines](https://github.com/CycloneDX/.github/blob/master/CONTRIBUTING.md) first.
390389

391-
To build and test the solution locally you should have .NET 6
390+
To build and test the solution locally you should have .NET 8
392391
installed. Standard commands like `dotnet build` and `dotnet test` work.
393392

394393
It is generally expected that pull requests will include relevant tests.

semver.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.27.1
1+
0.29.0

src/cyclonedx/Commands/Add/AddFilesCommand.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
using AntPathMatching;
3030
using CycloneDX.Models;
3131
using CycloneDX.Cli.Commands;
32+
using System.CommandLine.NamingConventionBinder;
3233

3334
namespace CycloneDX.Cli.Commands.Add
3435
{
@@ -44,8 +45,8 @@ public static void Configure(System.CommandLine.Command rootCommand)
4445
subCommand.Add(new Option<CycloneDXBomFormat>("--input-format", "Specify input file format."));
4546
subCommand.Add(new Option<CycloneDXBomFormat>("--output-format", "Specify output file format."));
4647
subCommand.Add(new Option<string>("--base-path", "Base path for directory to process (defaults to current working directory if omitted)."));
47-
subCommand.Add(new Option<List<string>>("--include", "Apache Ant style path and file patterns to specify what to include (defaults to all files, separate patterns with a space)."));
48-
subCommand.Add(new Option<List<string>>("--exclude", "Apache Ant style path and file patterns to specify what to exclude (defaults to none, separate patterns with a space)."));
48+
subCommand.Add(new Option<List<string>>("--include", "Apache Ant style path and file patterns to specify what to include (defaults to all files, separate patterns with a space).") { AllowMultipleArgumentsPerToken = true});
49+
subCommand.Add(new Option<List<string>>("--exclude", "Apache Ant style path and file patterns to specify what to exclude (defaults to none, separate patterns with a space).") { AllowMultipleArgumentsPerToken = true });
4950
subCommand.Handler = CommandHandler.Create<AddFilesCommandOptions>(AddFiles);
5051
rootCommand.Add(subCommand);
5152
}

src/cyclonedx/Commands/AnalyzeCommand.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using System;
1818
using System.CommandLine;
1919
using System.CommandLine.Invocation;
20+
using System.CommandLine.NamingConventionBinder;
2021
using System.Text.Json;
2122
using System.Threading.Tasks;
2223
using CycloneDX.Cli.Models;

src/cyclonedx/Commands/ConvertCommand.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using System;
1818
using System.CommandLine;
1919
using System.CommandLine.Invocation;
20+
using System.CommandLine.NamingConventionBinder;
2021
using System.Diagnostics.Contracts;
2122
using System.Threading.Tasks;
2223
using CycloneDX.Cli;

src/cyclonedx/Commands/DiffCommand.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using System;
1818
using System.CommandLine;
1919
using System.CommandLine.Invocation;
20+
using System.CommandLine.NamingConventionBinder;
2021
using System.Text.Json;
2122
using System.Text.Json.Serialization;
2223
using System.Threading.Tasks;

src/cyclonedx/Commands/KeyGenCommand.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using System;
1818
using System.CommandLine;
1919
using System.CommandLine.Invocation;
20+
using System.CommandLine.NamingConventionBinder;
2021
using System.IO;
2122
using System.Security.Cryptography;
2223
using System.Threading.Tasks;
@@ -37,7 +38,7 @@ internal static void Configure(RootCommand rootCommand)
3738
public static async Task<int> KeyGen(KeyGenCommandOptions options)
3839
{
3940
Console.WriteLine("Generating new public/private key pair...");
40-
using (RSA rsa = new RSACryptoServiceProvider(2048))
41+
using (var rsa = new RSACryptoServiceProvider(2048))
4142
{
4243
var publicKeyFilename = string.IsNullOrEmpty(options.PublicKeyFile) ? "public.key" : options.PublicKeyFile;
4344
Console.WriteLine($"Saving public key to {publicKeyFilename}");

0 commit comments

Comments
 (0)