Skip to content

Commit 540c720

Browse files
committed
Add GitVersion configuration and update CI/CD workflow for versioning
1 parent bfba63f commit 540c720

2 files changed

Lines changed: 41 additions & 2 deletions

File tree

.github/workflows/ci-cd.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,20 @@ jobs:
7272
- name: Determine Version
7373
id: gitversion
7474
uses: gittools/actions/gitversion/execute@v0.10.2
75+
with:
76+
useConfigFile: true
77+
configFilePath: GitVersion.yml
78+
79+
- name: Display Version
80+
run: |
81+
echo "Major: ${{ steps.gitversion.outputs.major }}"
82+
echo "Minor: ${{ steps.gitversion.outputs.minor }}"
83+
echo "Patch: ${{ steps.gitversion.outputs.patch }}"
84+
echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}"
85+
echo "SemVer: ${{ steps.gitversion.outputs.semVer }}"
86+
echo "FullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}"
87+
echo "NuGetVersionV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }}"
88+
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.commitsSinceVersionSource }}"
7589
7690
- name: Setup .NET
7791
uses: actions/setup-dotnet@v4
@@ -82,10 +96,10 @@ jobs:
8296
run: dotnet restore ${{ env.PROJECT_PATH }}
8397

8498
- name: Build
85-
run: dotnet build ${{ env.PROJECT_PATH }} --no-restore --configuration Release -p:Version=${{ steps.gitversion.outputs.MajorMinorPatch }}
99+
run: dotnet build ${{ env.PROJECT_PATH }} --no-restore --configuration Release -p:Version=${{ steps.gitversion.outputs.nuGetVersionV2 }}
86100

87101
- name: Pack
88-
run: dotnet pack ${{ env.PROJECT_PATH }} --no-build --configuration Release -p:PackageVersion=${{ steps.gitversion.outputs.MajorMinorPatch }} --output ./nupkg
102+
run: dotnet pack ${{ env.PROJECT_PATH }} --no-build --configuration Release -p:PackageVersion=${{ steps.gitversion.outputs.nuGetVersionV2 }} --output ./nupkg
89103

90104
- name: Publish to NuGet
91105
env:

GitVersion.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
mode: ContinuousDeployment
2+
branches:
3+
main:
4+
regex: ^main$
5+
mode: ContinuousDeployment
6+
tag: ''
7+
increment: Patch
8+
prevent-increment-of-merged-branch-version: true
9+
track-merge-target: false
10+
source-branches: []
11+
is-release-branch: true
12+
develop:
13+
regex: ^develop$
14+
mode: ContinuousDeployment
15+
tag: alpha
16+
increment: Minor
17+
prevent-increment-of-merged-branch-version: false
18+
track-merge-target: true
19+
source-branches: []
20+
feature:
21+
regex: ^features?[/-]
22+
mode: ContinuousDeployment
23+
tag: useBranchName
24+
increment: Inherit
25+
source-branches: ['develop', 'main']

0 commit comments

Comments
 (0)