Skip to content

Commit c820e11

Browse files
committed
add GitVersion
1 parent 059a7c0 commit c820e11

File tree

4 files changed

+55
-13
lines changed

4 files changed

+55
-13
lines changed

.github/workflows/build.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ jobs:
1313

1414
steps:
1515
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0 # Required for GitVersion to accurately determine version
18+
19+
- name: Install GitVersion
20+
uses: gittools/actions/gitversion/[email protected]
21+
with:
22+
versionSpec: '5.x'
23+
24+
- name: Determine Version
25+
id: gitversion
26+
uses: gittools/actions/gitversion/[email protected]
1627

1728
- uses: astral-sh/setup-uv@v5
1829

@@ -28,18 +39,11 @@ jobs:
2839
- name: Build
2940
run: |
3041
uv build
42+
env:
43+
HATCH_BUILD_HOOK_VCS_VERSION: ${{ steps.gitversion.outputs.semVer }}
3144

32-
- name: Check if version in pyproject.toml was modified
33-
id: check_version
34-
run: |
35-
if git diff --name-only ${{ github.sha }} ${{ github.event.before }} | grep -q 'pyproject.toml'; then
36-
echo "modified=true" >> $GITHUB_OUTPUT
37-
else
38-
echo "modified=false" >> $GITHUB_OUTPUT
39-
fi
40-
41-
- name: "Publish"
42-
if: ${{ steps.check_version.outputs.modified }} == 'true'
45+
- name: Publish
46+
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
4347
run: |
4448
uv publish
4549
env:

GitVersion.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
mode: Mainline
2+
next-version: 0.0.99
3+
major-version-bump-message: '\+semver:\s?(breaking|major)'
4+
minor-version-bump-message: '\+semver:\s?(feature|minor)'
5+
patch-version-bump-message: '\+semver:\s?(fix|patch)'
6+
no-bump-message: '\+semver:\s?(none|skip)'
7+
tag-prefix: 'v'
8+
commit-message-incrementing: Enabled
9+
branches:
10+
main:
11+
regex: ^main$|^master$
12+
tag: ''
13+
increment: Patch
14+
feature:
15+
regex: ^feature?\/
16+
tag: 'alpha'
17+
increment: Inherit
18+
hotfix:
19+
regex: ^hotfix?\/
20+
tag: 'beta'
21+
increment: Patch
22+
release:
23+
regex: ^release?\/
24+
tag: 'rc'
25+
increment: None
26+
ignore:
27+
sha: []
28+
merge-message-formats: {}

pyproject.toml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-langchain"
3-
version = "0.0.98"
3+
version = "0.0.98" # This will be overridden by GitVersion
44
description = "UiPath Langchain"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.10"
@@ -40,9 +40,15 @@ Homepage = "https://uipath.com"
4040
Repository = "https://github.com/UiPath/uipath-langchain-python"
4141

4242
[build-system]
43-
requires = ["hatchling"]
43+
requires = ["hatchling", "hatch-vcs"]
4444
build-backend = "hatchling.build"
4545

46+
[tool.hatch.version]
47+
source = "vcs"
48+
49+
[tool.hatch.build.hooks.vcs]
50+
version-file = "src/uipath_langchain/_version.py"
51+
4652
[dependency-groups]
4753
dev = [
4854
"mypy>=1.14.1",
@@ -52,6 +58,7 @@ dev = [
5258
"pytest-mock>=3.11.1",
5359
"pre-commit>=4.1.0",
5460
"numpy>=1.24.0",
61+
"hatch-vcs>=0.3.0",
5562
]
5663

5764
[project.optional-dependencies]

src/uipath_langchain/_version.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""Version information."""
2+
3+
__version__ = "0.0.0" # This will be replaced by GitVersion during build

0 commit comments

Comments
 (0)