Skip to content

Commit 42c802f

Browse files
author
Petr Sramek
committed
gitversion test
1 parent cde619a commit 42c802f

File tree

2 files changed

+152
-5
lines changed

2 files changed

+152
-5
lines changed

.github/workflows/dotnet.yml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,37 @@ name: .NET
22

33
on:
44
push:
5-
branches: [ $default-branch ]
5+
branches:
6+
- '**'
67
pull_request:
7-
branches: [ 'main' ]
8-
9-
env:
10-
dotnet_version: ${{ vars.DOTNET_VERSION }}
8+
branches:
9+
- '**'
1110

1211
concurrency: ${{ github.ref }}
1312

1413
jobs:
14+
version:
15+
name: Version with GitVersion ${{ vars.GIT_VERSION }}
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
- name: Install GitVersion ${{ vars.GIT_VERSION }}
22+
uses: gittools/actions/gitversion/setup@v3.1.11
23+
with:
24+
versionSpec: ${{ vars.GIT_VERSION }}
25+
preferLatestVersion: true
26+
- name: Update Version with GitVersion ${{ vars.GIT_VERSION }}
27+
uses: gittools/actions/gitversion/execute@v3.1.11
28+
with:
29+
useConfigFile: true
30+
configFilePath: ./.gitversion/version.yml
31+
updateAssemblyInfo: true
32+
- name: Write Version
33+
run: echo ${{ env.GitVersion_FullSemVer }}
34+
35+
1536
build:
1637
name: Build with .NET ${{ vars.DOTNET_VERSION }}
1738
runs-on: ubuntu-latest

.gitversion/version.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Global settings
2+
assembly-versioning-format: '{Major}.{Minor}.{Patch}.{env:BUILD_NUMBER ?? 0}'
3+
assembly-file-versioning-format: '{Major}.{Minor}.{Patch}.{env:BUILD_NUMBER ?? 0}'
4+
tag-prefix: '[vV]?'
5+
version-in-branch-pattern: (?<version>[vV]?\d+(\.\d+)?(\.\d+)?).*
6+
major-version-bump-message: ''
7+
minor-version-bump-message: ''
8+
patch-version-bump-message: ''
9+
no-bump-message: ''
10+
tag-pre-release-weight: 60000
11+
commit-date-format: yyyy-MM-dd
12+
merge-message-formats: {}
13+
update-build-number: false
14+
semantic-version-format: Strict
15+
strategies:
16+
- VersionInBranchName
17+
- TrackReleaseBranches
18+
mode: ContinuousDelivery
19+
label: ''
20+
increment: Patch
21+
prevent-increment:
22+
of-merged-branch: true
23+
when-branch-merged: true
24+
when-current-commit-tagged: true
25+
track-merge:
26+
target: false
27+
message: false
28+
commit-message-incrementing: Disabled
29+
regex: ''
30+
source-branches: []
31+
is-source-branch-for: []
32+
tracks-release-branches: false
33+
is-release-branch: false
34+
is-main-branch: false
35+
ignore:
36+
sha: []
37+
# Branch settings
38+
branches:
39+
# Release branch - branch tracks history for specific version
40+
release:
41+
mode: ContinuousDeployment
42+
regex: ^(release[\/][\d]+\.[\d]+)$
43+
increment: Inherit
44+
is-release-branch: true
45+
# Preview branch - branch accumulates changes for specific version before it is first released
46+
preview:
47+
mode: ContinuousDeployment
48+
regex: ^(release[\/][\d]+\.[\d]+\/preview)$
49+
increment: Inherit
50+
source-branches:
51+
- release
52+
# Hotfix branch - branch hotfixes a critical bug for specific version after it was first released
53+
hotfix:
54+
mode: ContinuousDeployment
55+
label: '{BranchName}'
56+
increment: Inherit
57+
regex: ^hotfix?[/-](?<BranchName>.+)
58+
tracks-release-branches: true
59+
source-branches:
60+
- release
61+
# Support branch - branch accumulates changes for specific version after it was first released
62+
support:
63+
mode: ContinuousDeployment
64+
regex: ^(release[\/][\d]+\.[\d]+\/support)$
65+
increment: Inherit
66+
source-branches:
67+
- release
68+
# Bugfixes branch - branch hotfixes bugs for specific version after it was first released
69+
bugfix:
70+
mode: ContinuousDeployment
71+
label: '{BranchName}'
72+
increment: Inherit
73+
regex: ^bugfix?[/-](?<BranchName>.+)
74+
tracks-release-branches: true
75+
source-branches:
76+
- support
77+
# Feature branch - branch accumulates changes for specific version after it was first released
78+
feature:
79+
mode: ContinuousDeployment
80+
label: '{BranchName}'
81+
increment: Inherit
82+
regex: ^feature?[/-](?<BranchName>.+)$
83+
tracks-release-branches: true
84+
source-branches:
85+
- preview
86+
# PR branch - branch merges a source branch to a target branch
87+
pull-request:
88+
mode: ContinuousDeployment
89+
label: pull-request
90+
increment: Inherit
91+
label-number-pattern: '[/-](?<number>\d+)'
92+
regex: ^(pull|pull\-requests|pr)[/-]
93+
source-branches:
94+
- main
95+
- release
96+
- preview
97+
- hotfix
98+
- support
99+
- bugfix
100+
- feature
101+
# Main branch - branch tracks historical changes between releases
102+
main:
103+
mode: ManualDeployment
104+
increment: Inherit
105+
regex: ^main$
106+
tracks-release-branches: true
107+
prevent-increment:
108+
of-merged-branch: false
109+
is-main-branch: true
110+
source-branches:
111+
- release
112+
# Any other branch
113+
unknown:
114+
mode: ManualDeployment
115+
label: '{BranchName}'
116+
increment: Inherit
117+
regex: (?<BranchName>.+)
118+
source-branches:
119+
- main
120+
- release
121+
- preview
122+
- hotfix
123+
- support
124+
- bugfix
125+
- feature
126+
- pull-request

0 commit comments

Comments
 (0)