Skip to content

Commit 5aebbcc

Browse files
committed
czafdew
1 parent 9d035fb commit 5aebbcc

File tree

5 files changed

+56
-227
lines changed

5 files changed

+56
-227
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: 'Determine version'
2+
author: 'Pete Sramek'
3+
description: 'Determines versions for the build.'
4+
inputs:
5+
# Required
6+
# Optional
7+
version-format:
8+
description: 'Version format. Default: ''(<Major>?/d+).(<Minor>?/d+)'''
9+
required: false
10+
default: '(<Major>?/d+).(<Minor>?/d+)'
11+
branch-name:
12+
description: 'Branch name. Default: ''${{ github.ref_name }}'''
13+
required: false
14+
default: '${{ github.ref_name }}'
15+
dotnet_sdk_version:
16+
description: '.NET SDK version. Default: ''9.x'''
17+
required: false
18+
default: '9.x'
19+
20+
runs:
21+
using: "composite"
22+
steps:
23+
- name: 'Checkout ${{ github.head_ref || github.ref }}'
24+
uses: actions/checkout@v5
25+
26+
- name: 'Setup .NET ${{ inputs.dotnet_sdk_version }}'
27+
uses: actions/setup-dotnet@v4
28+
with:
29+
dotnet-version: ${{ inputs.dotnet_sdk_version }}
30+
31+
- name: 'Capture version in branch name'
32+
shell: bash
33+
run: |
34+
echo "branch-name=${{ inputs.branch-name }}" >> $GITHUB_ENV
35+
echo "version-format=${{ inputs.version-format }}" >> $GITHUB_ENV
36+
echo "version=$(dotnet --version | sed -E 's/([0-9]+)\.([0-9]+).*/\1.\2/')" >> $GITHUB_ENV
37+
echo "major=$(echo ${{ inputs.branch-name }} | sed -E 's/${{ inputs.version-format }}/\1/')" >> $GITHUB_ENV
38+
echo "minor=$(echo ${{ inputs.branch-name }} | sed -E 's/${{ inputs.version-format }}/\2/')" >> $GITHUB_ENV

.github/workflows/build.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,24 @@ jobs:
5555
config-file-path: './.gitversion/version.yml'
5656
run-number: ${{ needs.workflow-variables.outputs.github-run-number }}
5757

58+
versioning-new:
59+
name: 'Determine versions (new)'
60+
needs: [workflow-variables]
61+
runs-on: ubuntu-latest
62+
steps:
63+
- name: 'Checkout ${{ github.head_ref || github.ref }}'
64+
uses: actions/checkout@v5
65+
- name: 'Setup .NET ${{ env.dotnet-sdk-version }}'
66+
uses: actions/setup-dotnet@v4
67+
with:
68+
dotnet-version: ${{ env.dotnet-sdk-version }}
69+
- name: 'Determine versions'
70+
id: versioning
71+
uses: './.github/actions/determine-version'
72+
with:
73+
branch-name: ${{ github.ref_name }}
74+
version-format: '(<Major>?/d+).(<Minor>?/d+)'
75+
5876
build:
5977
name: 'Compile source code'
6078
needs: [workflow-variables, versioning]

.github/workflows/codeql.yml

Lines changed: 0 additions & 97 deletions
This file was deleted.

.github/workflows/create-release.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/determine-version.yml

Lines changed: 0 additions & 103 deletions
This file was deleted.

0 commit comments

Comments
 (0)