@@ -7,14 +7,28 @@ inputs:
77 description : ' Branch name.'
88 required : true
99# Optional
10+ default-version :
11+ description : ' Default version to use if no match is found. Default: '' 0.0'' '
12+ required : false
13+ default : ' 0.0'
1014 version-format :
11- description : ' Version format. Default: '' (<Major>?/ d+).(<Minor>?/ d+)'' '
15+ description : ' Version format. Default: '' (\ d+).(\ d+)'' '
1216 required : false
1317 default : ' (\d+).(\d+)'
1418 dotnet_sdk_version :
1519 description : ' .NET SDK version. Default: '' 9.x'' '
1620 required : false
1721 default : ' 9.x'
22+ outputs :
23+ version :
24+ description : ' Version extracted from the branch name.'
25+ value : ${{ steps.regex-match.outputs.match }}
26+ major :
27+ description : ' Major version extracted from the branch name.'
28+ value : ${{ steps.regex-match.outputs.group1 }}
29+ minor :
30+ description : ' Minor version extracted from the branch name.'
31+ value : ${{ steps.regex-match.outputs.group2 }}
1832
1933runs :
2034 using : " composite"
@@ -27,19 +41,22 @@ runs:
2741 with :
2842 dotnet-version : ${{ inputs.dotnet_sdk_version }}
2943
30- - name : ' what what '
44+ - name : ' Match version '
3145 id : regex-match
3246 uses : actions-ecosystem/action-regex-match@v2
3347 with :
3448 text : ${{ inputs.branch-name }}
3549 regex : ${{ inputs.version-format }}
3650 flags : ' g'
3751
38- - name : ' Capture version in branch name'
52+ - name : ' Set version output'
53+ if : steps.regex-match.outputs.match != ''
54+ shell : bash
55+ run : |
56+ echo "version=${{ steps.regex-match.outputs.match }}" >> $GITHUB_OUTPUT
57+
58+ - name : ' Set default version output'
59+ if : steps.regex-match.outputs.match == ''
3960 shell : bash
4061 run : |
41- echo "${{ inputs.branch-name }}"
42- echo "${{ inputs.version-format }}"
43- echo "${{ steps.regex-match.outputs.match }}"
44- echo "${{ steps.regex-match.outputs.group1 }}"
45- echo "${{ steps.regex-match.outputs.group2 }}"
62+ echo "version=${{ inputs.default-version }}" >> $GITHUB_OUTPUT
0 commit comments