-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
56 lines (51 loc) · 1.6 KB
/
action.yml
File metadata and controls
56 lines (51 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: 'Extract version'
author: 'Pete Sramek'
description: 'Determines versions for the build.'
inputs:
# Required
branch-name:
description: 'Branch name.'
required: true
# Optional
default-version:
description: 'Default version to use if no match is found. Default: ''0.0'''
required: false
default: '0.0'
version-format:
description: 'Version format. Default: ''(\d+).(\d+)'''
required: false
default: '(\d+).(\d+)'
dotnet_sdk_version:
description: '.NET SDK version. Default: ''9.x'''
required: false
default: '9.x'
outputs:
version:
description: 'Version extracted from the branch name.'
value: ${{ steps.regex-match.outputs.match }}
runs:
using: "composite"
steps:
- name: 'Checkout ${{ github.head_ref || github.ref }}'
uses: actions/checkout@v5
- name: 'Setup .NET ${{ inputs.dotnet_sdk_version }}'
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ inputs.dotnet_sdk_version }}
- name: 'Extract version from branch name'
id: regex-match
uses: actions-ecosystem/action-regex-match@v2
with:
text: ${{ inputs.branch-name }}
regex: ${{ inputs.version-format }}
flags: 'g'
- name: 'Set extracted version output'
if: steps.regex-match.outputs.match != ''
shell: bash
run: |
echo "version=${{ steps.regex-match.outputs.match }}" >> $GITHUB_OUTPUT
- name: 'Set default version output'
if: steps.regex-match.outputs.match == ''
shell: bash
run: |
echo "version=${{ inputs.default-version }}" >> $GITHUB_OUTPUT