From f854fcfd5da5ae32ff8a4e5ac911fbdfd1577ae7 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Mon, 2 Mar 2026 11:42:18 +0100 Subject: [PATCH 1/3] Add dotnet pack push composite action --- actions/dotnet/pack-push/action.yml | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 actions/dotnet/pack-push/action.yml diff --git a/actions/dotnet/pack-push/action.yml b/actions/dotnet/pack-push/action.yml new file mode 100644 index 0000000..404942f --- /dev/null +++ b/actions/dotnet/pack-push/action.yml @@ -0,0 +1,39 @@ +name: Pack & Push +description: Package .NET projects and push to the registry + +inputs: + dotnet-version: + description: .NET SDK version to be used + required: false + default: "10.0" + registry-token: + description: Registry + required: true + registry-address: + description: Registry address (NuGet.org by default) + required: false + default: "https://api.nuget.org/v3/index.json" + push-enabled: + description: Push + required: false + default: "false" + +runs: + using: "composite" + steps: + - name: Install .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: ${{ inputs.dotnet-version }} + - name: Package + # "**/*.csproj;!**/*Tests.csproj" + run: dotnet pack --configuration Release -o output + shell: bash + env: + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + DOTNET_NOLOGO: 1 + - name: Push to registry + if: ${{ inputs.push-enabled == 'true' }} + # "$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg" + run: for f in output/*.nupkg; do dotnet nuget push "$f" --api-key ${{ inputs.registry-token }} --source ${{ inputs.registry-address }} ; done + shell: bash From e0707dae4fc9b3aae385c73edbb21c2cc5e1d4e4 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Mon, 2 Mar 2026 12:12:47 +0100 Subject: [PATCH 2/3] Add dotnet env vars --- .github/workflows/reusable-dotnet-quality.yml | 2 ++ actions/dotnet/build-test-sonar/action.yml | 3 +++ actions/dotnet/build-test/action.yml | 3 +++ actions/dotnet/pack-push/action.yml | 2 ++ 4 files changed, 10 insertions(+) diff --git a/.github/workflows/reusable-dotnet-quality.yml b/.github/workflows/reusable-dotnet-quality.yml index c3548f5..e994229 100644 --- a/.github/workflows/reusable-dotnet-quality.yml +++ b/.github/workflows/reusable-dotnet-quality.yml @@ -171,5 +171,7 @@ jobs: ./**/Summary.txt ./**/fossa.html env: + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + DOTNET_NOLOGO: 1 # https://docs.github.com/en/actions/reference/workflows-and-actions/contexts GITHUB_TOKEN: ${{ github.token }} diff --git a/actions/dotnet/build-test-sonar/action.yml b/actions/dotnet/build-test-sonar/action.yml index 5806512..cf74a8a 100644 --- a/actions/dotnet/build-test-sonar/action.yml +++ b/actions/dotnet/build-test-sonar/action.yml @@ -78,6 +78,9 @@ runs: - name: Build .NET solution run: dotnet build --no-restore --configuration Debug shell: bash + env: + BUILD_SOURCEBRANCHNAME: ${{ github.run_id }} + BUILD_BUILDID: ${{ github.ref_name }} - name: Run tests run: | dotnet test --no-build --verbosity normal --configuration Debug \ diff --git a/actions/dotnet/build-test/action.yml b/actions/dotnet/build-test/action.yml index e98e4ea..c550bb8 100644 --- a/actions/dotnet/build-test/action.yml +++ b/actions/dotnet/build-test/action.yml @@ -17,6 +17,9 @@ runs: - name: Build .NET code run: dotnet build --no-restore --configuration Debug shell: bash + env: + BUILD_SOURCEBRANCHNAME: ${{ github.run_id }} + BUILD_BUILDID: ${{ github.ref_name }} - name: Run tests run: | dotnet test --no-build --verbosity normal --configuration Debug \ diff --git a/actions/dotnet/pack-push/action.yml b/actions/dotnet/pack-push/action.yml index 404942f..8257de7 100644 --- a/actions/dotnet/pack-push/action.yml +++ b/actions/dotnet/pack-push/action.yml @@ -32,6 +32,8 @@ runs: env: DOTNET_CLI_TELEMETRY_OPTOUT: 1 DOTNET_NOLOGO: 1 + BUILD_SOURCEBRANCHNAME: ${{ github.run_id }} + BUILD_BUILDID: ${{ github.ref_name }} - name: Push to registry if: ${{ inputs.push-enabled == 'true' }} # "$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg" From 16f2838aead0737e30443c10ec8e2bb41620dc1c Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Mon, 2 Mar 2026 15:08:25 +0100 Subject: [PATCH 3/3] Fix typo --- actions/dotnet/build-test-sonar/action.yml | 4 ++-- actions/dotnet/build-test/action.yml | 4 ++-- actions/dotnet/pack-push/action.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/actions/dotnet/build-test-sonar/action.yml b/actions/dotnet/build-test-sonar/action.yml index cf74a8a..04b4b76 100644 --- a/actions/dotnet/build-test-sonar/action.yml +++ b/actions/dotnet/build-test-sonar/action.yml @@ -79,8 +79,8 @@ runs: run: dotnet build --no-restore --configuration Debug shell: bash env: - BUILD_SOURCEBRANCHNAME: ${{ github.run_id }} - BUILD_BUILDID: ${{ github.ref_name }} + BUILD_SOURCEBRANCHNAME: ${{ github.ref_name }} + BUILD_BUILDID: ${{ github.run_id }} - name: Run tests run: | dotnet test --no-build --verbosity normal --configuration Debug \ diff --git a/actions/dotnet/build-test/action.yml b/actions/dotnet/build-test/action.yml index c550bb8..d13591e 100644 --- a/actions/dotnet/build-test/action.yml +++ b/actions/dotnet/build-test/action.yml @@ -18,8 +18,8 @@ runs: run: dotnet build --no-restore --configuration Debug shell: bash env: - BUILD_SOURCEBRANCHNAME: ${{ github.run_id }} - BUILD_BUILDID: ${{ github.ref_name }} + BUILD_SOURCEBRANCHNAME: ${{ github.ref_name }} + BUILD_BUILDID: ${{ github.run_id }} - name: Run tests run: | dotnet test --no-build --verbosity normal --configuration Debug \ diff --git a/actions/dotnet/pack-push/action.yml b/actions/dotnet/pack-push/action.yml index 8257de7..a1de296 100644 --- a/actions/dotnet/pack-push/action.yml +++ b/actions/dotnet/pack-push/action.yml @@ -32,8 +32,8 @@ runs: env: DOTNET_CLI_TELEMETRY_OPTOUT: 1 DOTNET_NOLOGO: 1 - BUILD_SOURCEBRANCHNAME: ${{ github.run_id }} - BUILD_BUILDID: ${{ github.ref_name }} + BUILD_SOURCEBRANCHNAME: ${{ github.ref_name }} + BUILD_BUILDID: ${{ github.run_id }} - name: Push to registry if: ${{ inputs.push-enabled == 'true' }} # "$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg"