Skip to content

Commit f21dbfd

Browse files
committed
feat: Update .NET SDK version to 10.0.x and enhance platform matrix support
- Changed default SDK version from 9.0.x to 10.0.x in dotnet-nuget action. - Added target-frameworks and artifact-suffix inputs to dotnet-nuget action. - Enhanced restore, build, and pack commands to support specified target frameworks. - Introduced platform matrix support in dotnet-publish-library workflow for parallel builds on Linux and Windows. - Updated example workflows to reflect the new SDK version and platform matrix capabilities. - Added a new example workflow for Windows Desktop applications using platform matrix.
1 parent a02065f commit f21dbfd

File tree

7 files changed

+627
-44
lines changed

7 files changed

+627
-44
lines changed

.github/actions/dotnet-nuget/action.yml

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@ inputs:
1818
dotnet-version:
1919
description: 'SDK version(s) to use (comma-separated for multiple)'
2020
required: false
21-
default: '9.0.x'
21+
default: '10.0.x'
22+
target-frameworks:
23+
description: 'Target frameworks to build (semicolon-separated, e.g., "net8.0;net9.0"). Leave empty to build all TFMs from project.'
24+
required: false
25+
default: ''
26+
artifact-suffix:
27+
description: 'Suffix to append to artifact names (for platform matrix builds, e.g., "-windows", "-crossplatform")'
28+
required: false
29+
default: ''
2230

2331
# Testing
2432
run-tests:
@@ -311,7 +319,15 @@ runs:
311319
working-directory: ${{ inputs.working-directory }}
312320
run: |
313321
echo "Restoring NuGet packages..."
314-
dotnet restore "${{ inputs.project-path }}"
322+
323+
RESTORE_ARGS=""
324+
TARGET_FRAMEWORKS="${{ inputs.target-frameworks }}"
325+
if [ -n "$TARGET_FRAMEWORKS" ]; then
326+
echo "Restoring for specified frameworks: $TARGET_FRAMEWORKS"
327+
RESTORE_ARGS="-p:TargetFrameworks=\"$TARGET_FRAMEWORKS\""
328+
fi
329+
330+
dotnet restore "${{ inputs.project-path }}" $RESTORE_ARGS
315331
316332
# =========================================================================
317333
# Build
@@ -328,6 +344,13 @@ runs:
328344
# Add version
329345
BUILD_ARGS="$BUILD_ARGS -p:Version=${{ steps.version.outputs.version }}"
330346
347+
# Add target framework filter if specified (for platform matrix builds)
348+
TARGET_FRAMEWORKS="${{ inputs.target-frameworks }}"
349+
if [ -n "$TARGET_FRAMEWORKS" ]; then
350+
echo "Building only specified frameworks: $TARGET_FRAMEWORKS"
351+
BUILD_ARGS="$BUILD_ARGS -p:TargetFrameworks=\"$TARGET_FRAMEWORKS\""
352+
fi
353+
331354
# Add deterministic build option
332355
if [ "${{ inputs.deterministic-build }}" = "true" ]; then
333356
BUILD_ARGS="$BUILD_ARGS -p:Deterministic=true -p:ContinuousIntegrationBuild=true"
@@ -462,6 +485,13 @@ runs:
462485
PACK_ARGS="-c ${{ inputs.configuration }} --no-build -o nupkg"
463486
PACK_ARGS="$PACK_ARGS -p:Version=${{ steps.version.outputs.version }}"
464487
488+
# Add target framework filter if specified (for platform matrix builds)
489+
TARGET_FRAMEWORKS="${{ inputs.target-frameworks }}"
490+
if [ -n "$TARGET_FRAMEWORKS" ]; then
491+
echo "Packing only specified frameworks: $TARGET_FRAMEWORKS"
492+
PACK_ARGS="$PACK_ARGS -p:TargetFrameworks=\"$TARGET_FRAMEWORKS\""
493+
fi
494+
465495
# Add symbol package option
466496
if [ "${{ inputs.include-symbols }}" = "true" ]; then
467497
PACK_ARGS="$PACK_ARGS --include-symbols -p:SymbolPackageFormat=snupkg"
@@ -618,15 +648,15 @@ runs:
618648
if: inputs.create-package == 'true' && steps.pack.outputs.package-path != ''
619649
uses: actions/upload-artifact@v4
620650
with:
621-
name: nuget-packages
651+
name: nuget-packages${{ inputs.artifact-suffix }}
622652
path: ${{ inputs.working-directory }}/nupkg/
623653
retention-days: 30
624654

625655
- name: Upload Test Results
626656
if: inputs.run-tests == 'true' && inputs.collect-coverage == 'true'
627657
uses: actions/upload-artifact@v4
628658
with:
629-
name: test-results
659+
name: test-results${{ inputs.artifact-suffix }}
630660
path: ${{ inputs.working-directory }}/TestResults/
631661
retention-days: 30
632662
continue-on-error: true

0 commit comments

Comments
 (0)