Skip to content

Commit a05d867

Browse files
committed
updated
1 parent 56c0cbe commit a05d867

3 files changed

Lines changed: 101 additions & 13 deletions

File tree

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: 'Build with .NET CLI'
2+
author: 'Pete Sramek'
3+
description: 'Compiles source code, uploads build artifacts.'
4+
inputs:
5+
# Required
6+
config-file-path:
7+
description: 'Path to the configuration file.'
8+
required: true
9+
run-number:
10+
description: 'The run number of the parent workflow.'
11+
required: true
12+
# Optional
13+
dotnet-sdk-version:
14+
description: 'Version of the .NET SDK to use. Default: ''9.0.x''.'
15+
required: false
16+
default: '9.0.x'
17+
gitversion-version:
18+
description: 'Version of GitVersion to use. Default: ''6.1.x''.'
19+
required: false
20+
default: '6.1.x'
21+
prerelease-tag:
22+
description: 'The prerelease tag to use. Default: ''''.'
23+
required: false
24+
default: ''
25+
outputs:
26+
friendly-version:
27+
description: "The friedly version."
28+
value: ${{ jobs.version.outputs.friendly-version }}
29+
assembly-version:
30+
description: "The assembly version."
31+
value: ${{ jobs.version.outputs.assembly-version }}
32+
assembly-informational-version:
33+
description: "The assembly informational version."
34+
value: ${{ jobs.version.outputs.assembly-informational-version }}
35+
file-version:
36+
description: "The file version."
37+
value: ${{ jobs.version.outputs.file-version }}
38+
package-version:
39+
description: "The package version."
40+
value: ${{ jobs.version.outputs.package-version }}
41+
42+
runs:
43+
using: "composite"
44+
steps:
45+
46+
- name: 'Checkout ${{ github.head_ref || github.ref }}'
47+
uses: actions/checkout@v4
48+
with:
49+
fetch-depth: 0
50+
51+
- name: 'Setup GitVersion ${{ env.git-version }}'
52+
uses: gittools/actions/gitversion/setup@v4.1.0
53+
with:
54+
versionSpec: ${{ inputs.gitversion-version }}
55+
preferLatestVersion: true
56+
57+
- name: 'Determine version'
58+
id: gitversion
59+
uses: gittools/actions/gitversion/execute@v4.1.0
60+
with:
61+
configFilePath: ${{ inputs.config-file-path }}
62+
63+
- name: 'Set friendly version'
64+
shell: bash
65+
run: echo "friendly-version=${{ steps.gitversion.outputs.assemblySemVer }}" >> $GITHUB_ENV
66+
67+
- name: 'Set assembly version'
68+
shell: bash
69+
run: echo "assembly-version=${{ steps.gitversion.outputs.assemblySemVer }}.${{ inputs.run-number }}.${{ steps.gitversion.outputs.CommitsSinceVersionSource }}" >> $GITHUB_ENV
70+
71+
- name: 'Set assembly informational version'
72+
shell: bash
73+
run: echo "assembly-informational-version=${{ steps.gitversion.outputs.assemblySemVer }}.${{ inputs.run-number }}+${{ steps.gitversion.outputs.sha }}" >> $GITHUB_ENV
74+
75+
- name: 'Set file version'
76+
shell: bash
77+
run: echo "file-version=${{ steps.gitversion.outputs.AssemblySemFileVer }}.${{ inputs.run-number }}.${{ steps.gitversion.outputs.CommitsSinceVersionSource }}" >> $GITHUB_ENV
78+
79+
- if: ${{ steps.gitversion.outputs.PreReleaseLabelWithDash == '' }}
80+
name: 'Set package version'
81+
shell: bash
82+
run: echo "package-version=${{ steps.gitversion.outputs.AssemblySemVer }}.${{ inputs.run-number }}" >> $GITHUB_ENV
83+
84+
- if: ${{ steps.gitversion.outputs.PreReleaseLabelWithDash != '' }}
85+
name: 'Set package version'
86+
shell: bash
87+
run: echo "package-version=${{ steps.gitversion.outputs.AssemblySemVer }}.${{ inputs.run-number }}-${{ steps.gitversion.outputs.PreReleaseLabel }}-${{ steps.gitversion.outputs.CommitsSinceVersionSource }}" >> $GITHUB_ENV

.github/workflows/build.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,21 @@ jobs:
5050
versioning:
5151
name: 'Determine assembly version'
5252
needs: [global-variables]
53+
runs-on: ubuntu-latest
5354

54-
uses: ./.github/workflows/determine-version.yml
55-
with:
56-
config-file-path: './.gitversion/version.yml'
57-
run-number: ${{ needs.global-variables.outputs.github-run-number }}
55+
outputs:
56+
friendly-version: ${{ steps.determine-version.outputs.friendly-version }}
57+
assembly-version: ${{ steps.determine-version.outputs.assembly-version }}
58+
assembly-informational-version: ${{ steps.determine-version.outputs.assembly-informational-version }}
59+
file-version: ${{ steps.determine-version.outputs.file-version }}
60+
package-version: ${{ steps.determine-version.outputs.package-version }}
61+
62+
steps:
63+
- uses: ./.github/actins/determine-version
64+
id: determine-version
65+
with:
66+
config-file-path: './.gitversion/version.yml'
67+
run-number: ${{ needs.global-variables.outputs.github-run-number }}
5868

5969
build:
6070
name: 'Build source code'

.github/workflows/determine-version.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,4 @@ jobs:
101101
name: 'Set package version'
102102
shell: bash
103103
run: echo "package-version=${{ steps.gitversion.outputs.AssemblySemVer }}.${{ inputs.run-number }}-${{ steps.gitversion.outputs.PreReleaseLabel }}-${{ steps.gitversion.outputs.CommitsSinceVersionSource }}" >> $GITHUB_ENV
104-
105-
- name: 'Outputs'
106-
shell: bash
107-
run: |
108-
echo "friendly-version=${{ env.friendly-version }}"
109-
echo "assembly-version=${{ env.assembly-version }}"
110-
echo "assembly-informational-version=${{ env.assembly-informational-version }}"
111-
echo "file-version=${{ env.file-version }}"
112-
echo "package-version=${{ env.package-version }}"
113104

0 commit comments

Comments
 (0)