-
Notifications
You must be signed in to change notification settings - Fork 1
97 lines (84 loc) · 3.54 KB
/
determine-version.yml
File metadata and controls
97 lines (84 loc) · 3.54 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: 'Determine version'
on:
workflow_call:
inputs:
# Required
config-file-path:
description: 'Path to the configuration file.'
type: string
required: true
run-number:
description: 'The run number of the parent workflow.'
type: string
required: true
# Optional
dotnet-sdk-version:
description: 'Version of the .NET SDK to use. Default: ''9.0.x''.'
type: string
required: false
default: '9.0.x'
gitversion-version:
description: 'Version of GitVersion to use. Default: ''6.0.x''.'
required: false
type: string
default: '6.0.x'
prerelease-tag:
description: 'The prerelease tag to use. Default: ''''.'
type: string
required: false
default: ''
outputs:
assembly-version:
description: "The assembly version."
value: ${{ jobs.version.outputs.assembly-version }}
assembly-informational-version:
description: "The assembly informational version."
value: ${{ jobs.version.outputs.assembly-informational-version }}
file-version:
description: "The file version."
value: ${{ jobs.version.outputs.file-version }}
package-version:
description: "The package version."
value: ${{ jobs.version.outputs.package-version }}
jobs:
version:
name: 'Version'
runs-on: ubuntu-latest
outputs:
assembly-version: ${{ env.assembly-version }}
assembly-informational-version: ${{ env.assembly-informational-version }}
file-version: ${{ env.file-version }}
package-version: ${{ env.package-version }}
steps:
- name: 'Checkout ${{ github.head_ref || github.ref }}'
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 'Setup GitVersion ${{ env.git-version }}'
uses: gittools/actions/gitversion/setup@v4.0.0
with:
versionSpec: ${{ inputs.gitversion-version }}
preferLatestVersion: true
- name: 'Determine version'
id: gitversion
uses: gittools/actions/gitversion/execute@v4.0.0
with:
useConfigFile: true
configFilePath: ${{ inputs.config-file-path }}
- name: 'Set assembly version'
shell: bash
run: echo "assembly-version=${{ steps.gitversion.outputs.AssemblySemFileVer }}.${{ inputs.run-number }}.${{ steps.gitversion.outputs.CommitsSinceVersionSource }}" >> $GITHUB_ENV
- name: 'Set assembly informational version'
shell: bash
run: echo "assembly-informational-version=${{ steps.gitversion.outputs.assemblySemVer }}.${{ inputs.run-number }}+${{ steps.gitversion.outputs.sha }}" >> $GITHUB_ENV
- name: 'Set file version'
shell: bash
run: echo "file-version=${{ steps.gitversion.outputs.AssemblySemFileVer }}.${{ inputs.run-number }}.${{ steps.gitversion.outputs.CommitsSinceVersionSource }}" >> $GITHUB_ENV
- if: ${{ steps.gitversion.outputs.PreReleaseLabelWithDash == '' }}
name: 'Set package version'
shell: bash
run: echo "package-version=${{ steps.gitversion.outputs.AssemblySemVer }}.${{ inputs.run-number }}" >> $GITHUB_ENV
- if: ${{ steps.gitversion.outputs.PreReleaseLabelWithDash != '' }}
name: 'Set package version'
shell: bash
run: echo "package-version=${{ steps.gitversion.outputs.AssemblySemVer }}.${{ inputs.run-number }}-${{ steps.gitversion.outputs.PreReleaseLabel }}-${{ steps.gitversion.outputs.CommitsSinceVersionSource }}" >> $GITHUB_ENV