88 push :
99 tags :
1010 - ' v*.*.*' # Triggers on version tags like v1.0.0, v2.1.3, etc.
11+ workflow_dispatch :
12+ inputs :
13+ version :
14+ description : ' Version to release (e.g., 1.0.0)'
15+ required : true
16+ type : string
17+ publish_to_nuget :
18+ description : ' Publish to NuGet.org'
19+ required : false
20+ type : boolean
21+ default : false
1122
1223jobs :
1324 build :
@@ -25,16 +36,35 @@ jobs:
2536 - dotnet-version : ' 8.0.x'
2637 framework-moniker : ' net8.0'
2738
39+ outputs :
40+ version : ${{ steps.determine_version.outputs.version }}
41+ assembly-version : ${{ steps.determine_version.outputs.assembly-version }}
42+ file-version : ${{ steps.determine_version.outputs.file-version }}
43+ informational-version : ${{ steps.determine_version.outputs.informational-version }}
44+
2845 steps :
2946 - uses : actions/checkout@v4
3047
31- - name : " Extract version from tag "
32- id : extract_version
48+ - name : " Determine version"
49+ id : determine_version
3350 run : |
34- # Remove 'v' prefix from tag and extract version
35- VERSION=${GITHUB_REF#refs/tags/v}
51+ if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
52+ # Manual trigger - use input version
53+ VERSION="${{ github.event.inputs.version }}"
54+ echo "Using manual version: $VERSION"
55+ else
56+ # Tag trigger - extract version from tag
57+ VERSION=${GITHUB_REF#refs/tags/v}
58+ echo "Extracted version from tag: $VERSION"
59+ fi
60+
61+ # Set version outputs for different version types
3662 echo "version=$VERSION" >> $GITHUB_OUTPUT
37- echo "Extracted version: $VERSION"
63+ echo "assembly-version=$VERSION" >> $GITHUB_OUTPUT
64+ echo "file-version=$VERSION" >> $GITHUB_OUTPUT
65+ echo "informational-version=$VERSION" >> $GITHUB_OUTPUT
66+
67+ echo "Final version: $VERSION"
3868
3969 - name : " Setup .NET ${{ matrix.dotnet-version }}"
4070 uses : actions/setup-dotnet@v4
6090 needs : build
6191 uses : ./.github/workflows/publish-packages.yml
6292 with :
63- nuget : true
93+ nuget : ${{ github.event_name == 'push' || github.event.inputs.publish_to_nuget == 'true' }}
94+ version : ${{ needs.build.outputs.version }}
95+ assembly-version : ${{ needs.build.outputs.assembly-version }}
96+ file-version : ${{ needs.build.outputs.file-version }}
97+ informational-version : ${{ needs.build.outputs.informational-version }}
6498
6599 clean :
66100 name : " Cleaning Old Packages"
0 commit comments