Skip to content

Commit 0768f02

Browse files
facusantilloFacundo Santillo Alarcon
andauthored
Add gitversion and workflow (#1)
Co-authored-by: Facundo Santillo Alarcon <facundo.santillo@wolterskluwers.com>
1 parent b74c05f commit 0768f02

File tree

2 files changed

+191
-0
lines changed

2 files changed

+191
-0
lines changed

.github/workflows/ci-pipeline.yaml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: CI Pipeline
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- main
8+
- release/*
9+
10+
jobs:
11+
setup:
12+
runs-on: ubuntu-latest
13+
14+
env:
15+
GitToolVersion: 6.0.3
16+
17+
steps:
18+
# Checkout the repository
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0 # Fetch all history to get full git version details
23+
24+
# Install GitVersion tool
25+
- name: Install GitVersion
26+
uses: gittools/actions/gitversion/setup@v3.0.0
27+
with:
28+
versionSpec: ${{ env.GitToolVersion }}
29+
includePrerelease: true
30+
31+
# Run GitVersion
32+
- name: Execute GitVersion
33+
id: gitversion # GitHub Actions ID for future reference
34+
uses: gittools/actions/gitversion/execute@v3.0.0
35+
with:
36+
useConfigFile: true
37+
configFilePath: "GitVersion.yml"
38+
39+
# Set the build number based on GitVersion and PR number
40+
- name: Set Build Number
41+
if: github.event_name == 'pull_request'
42+
run: |
43+
PR_NUMBER=${{ github.event.pull_request.number }}
44+
VERSION="${{ steps.gitversion.outputs.semver }}"
45+
echo "Build number: $VERSION"
46+
echo "GITHUB_RUN_NUMBER=$VERSION" >> $GITHUB_ENV
47+
48+
# Set the build number based on GitVersion (release|main)
49+
- name: Set Build Number for Main|Release
50+
if: github.event_name != 'pull_request'
51+
run: |
52+
VERSION="${{ steps.gitversion.outputs.semver }}"
53+
echo "Build number: $VERSION"
54+
echo "GITHUB_RUN_NUMBER=$VERSION" >> $GITHUB_ENV
55+
56+
# Set GitVersion variables for later use
57+
- name: Set GitVersion variables
58+
run: |
59+
echo "SemVer=${{ steps.gitversion.outputs.semver }}" >> $GITHUB_ENV
60+
echo "MajorMinorPatch=${{ steps.gitversion.outputs.majorminorpatch }}" >> $GITHUB_ENV
61+
62+
# Tag the repository (only for main or release branches, not pull requests)
63+
- name: Tag repo
64+
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/'))
65+
run: |
66+
git config user.name "github-actions[bot]"
67+
git config user.email "github-actions[bot]@users.noreply.github.com"
68+
git tag ${{ steps.gitversion.outputs.semver }}
69+
git push origin ${{ steps.gitversion.outputs.semver }}

GitVersion.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
mode: ManualDeployment
2+
commit-message-incrementing: Enabled
3+
strategies:
4+
- Fallback
5+
- MergeMessage
6+
- TaggedCommit
7+
8+
branches:
9+
main:
10+
mode: ManualDeployment
11+
label: 'rev'
12+
increment: Minor
13+
prevent-increment:
14+
of-merged-branch: true
15+
when-current-commit-tagged: true
16+
track-merge-target: true
17+
track-merge-message: true
18+
regex: ^main$|^master$
19+
source-branches: []
20+
is-source-branch-for: []
21+
tracks-release-branches: false
22+
is-release-branch: false
23+
is-main-branch: true
24+
pre-release-weight: 60000
25+
26+
develop:
27+
mode: ManualDeployment
28+
label: 'rev'
29+
increment: Minor
30+
prevent-increment:
31+
when-current-commit-tagged: false
32+
track-merge-target: true
33+
track-merge-message: true
34+
regex: ^develop$
35+
source-branches: []
36+
is-source-branch-for: []
37+
tracks-release-branches: false
38+
is-release-branch: false
39+
is-main-branch: false
40+
pre-release-weight: 60000
41+
42+
release:
43+
mode: ManualDeployment
44+
label: 'rev'
45+
increment: Patch
46+
prevent-increment:
47+
of-merged-branch: true
48+
when-current-commit-tagged: false
49+
track-merge-target: true
50+
regex: ^releas(e|es)?[/-]
51+
source-branches: []
52+
is-source-branch-for: []
53+
tracks-release-branches: false
54+
is-release-branch: true
55+
is-main-branch: false
56+
pre-release-weight: 30000
57+
58+
feature:
59+
mode: ContinuousDelivery
60+
label: '{BranchName}'
61+
increment: Inherit
62+
prevent-increment:
63+
when-current-commit-tagged: false
64+
track-merge-target: true
65+
track-merge-message: true
66+
regex: ^features?[/-](?<BranchName>.+)
67+
source-branches:
68+
- feature
69+
- hotfix
70+
- develop
71+
- main
72+
- release
73+
is-source-branch-for: []
74+
tracks-release-branches: false
75+
is-release-branch: false
76+
is-main-branch: false
77+
pre-release-weight: 30000
78+
79+
pull-request:
80+
mode: ContinuousDelivery
81+
label: 'PR'
82+
increment: Inherit
83+
prevent-increment:
84+
of-merged-branch: true
85+
when-current-commit-tagged: false
86+
label-number-pattern: '[/-](?<number>\d+)'
87+
track-merge-target: false
88+
track-merge-message: true
89+
regex: ^pull?
90+
source-branches:
91+
- develop
92+
- main
93+
- release
94+
- feature
95+
- hotfix
96+
is-source-branch-for: []
97+
tracks-release-branches: false
98+
is-release-branch: false
99+
is-main-branch: false
100+
pre-release-weight: 30000
101+
102+
hotfix:
103+
mode: ContinuousDelivery
104+
label: '{BranchName}'
105+
increment: Patch
106+
prevent-increment:
107+
when-current-commit-tagged: false
108+
track-merge-target: true
109+
regex: ^hotfix(es)?[/-]
110+
source-branches:
111+
- main
112+
- develop
113+
- release
114+
is-source-branch-for: []
115+
tracks-release-branches: false
116+
is-release-branch: true
117+
is-main-branch: false
118+
pre-release-weight: 30000
119+
120+
ignore:
121+
sha: []
122+

0 commit comments

Comments
 (0)