-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
66 lines (63 loc) · 2.49 KB
/
action.yml
File metadata and controls
66 lines (63 loc) · 2.49 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
57
58
59
60
61
62
63
64
65
66
name: 'Format version'
author: 'Pete Sramek'
description: 'Formats versions.'
inputs:
# Required
version:
description: 'Version to use.'
required: true
patch:
description: 'Patch version to append to the formatted version.'
required: true
build-number:
description: 'Build number to append to the formatted version.'
required: true
sha:
description: 'Commit SHA to append to the formatted version.'
required: true
pre-release-tag:
description: 'Pre-release tag to append to the formatted version.'
required: true
# Optional
dotnet_sdk_version:
description: '.NET SDK version. Default: ''9.x'''
required: false
default: '9.x'
outputs:
friendly-version:
description: 'Formatted friendly version.'
value: ${{ steps.format-version.outputs.friendly-version }}
assembly-version:
description: 'Formatted assembly version.'
value: ${{ steps.format-version.outputs.assembly-version }}
assembly-informational-version:
description: 'Formatted assembly informational version.'
value: ${{ steps.format-version.outputs.assembly-informational-version }}
file-version:
description: 'Formatted file version.'
value: ${{ steps.format-version.outputs.file-version }}
release-version:
description: 'Formatted release version.'
value: ${{ steps.format-version.outputs.release-version }}
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: 'Format version'
shell: bash
id: format-version
run: |
echo "friendly-version=${{ inputs.version }}" >> $GITHUB_OUTPUT
echo "assembly-version=${{ inputs.version }}.${{ inputs.patch }}.${{ inputs.build-number }}" >> $GITHUB_OUTPUT
echo "assembly-informational-version=${{ inputs.version }}.${{ inputs.patch }}+${{ inputs.sha }}" >> $GITHUB_OUTPUT
echo "file-version=${{ inputs.version }}.${{ inputs.patch }}.${{ inputs.build-number }}" >> $GITHUB_OUTPUT
if [ -n "${{ inputs.pre-release-tag }}" ]; then
echo "release-version=${{ inputs.version }}.${{ inputs.patch }}-${{ inputs.pre-release-tag }}.${{ inputs.build-number }}" >> $GITHUB_OUTPUT
else
echo "release-version=${{ inputs.version }}.${{ inputs.patch }}.${{ inputs.build-number }}" >> $GITHUB_OUTPUT
fi