Skip to content

Commit d8d9495

Browse files
Merge pull request #6 from nextmv-io/feature/dynamic-version
Use a dynamic version
2 parents 4ef4ce3 + cb3ec5c commit d8d9495

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

.github/workflows/publish.yml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
name: publish
22

33
on:
4-
release:
5-
types: [created]
4+
push:
5+
tags:
6+
- "v*.*.*"
67

78
jobs:
89
publish:
910
runs-on: ubuntu-latest
11+
env:
12+
VERSION: ""
1013
steps:
11-
- name: git clone
14+
- name: get version from tag
15+
run: |
16+
VERSION=${{ github.ref_name }}
17+
echo "Version = $VERSION"
18+
echo "VERSION=$VERSION" >> $GITHUB_ENV
19+
20+
- name: git clone develop
1221
uses: actions/checkout@v4
22+
with:
23+
ref: develop
1324

1425
- name: Set up Python
1526
uses: actions/setup-python@v4
@@ -19,7 +30,10 @@ jobs:
1930
- name: install dependencies
2031
run: |
2132
pip install --upgrade pip
22-
pip install build twine
33+
pip install build twine hatch
34+
35+
- name: upgrade version with hatch
36+
run: hatch version ${{ env.VERSION }}
2337

2438
- name: build binary wheel and source tarball
2539
env:
@@ -39,3 +53,11 @@ jobs:
3953
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
4054
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
4155
run: twine upload dist/*
56+
57+
- name: commit new version
58+
run: |
59+
git config --global user.name "Nextmv Bot"
60+
git config --global user.email "bot@nextmv.io"
61+
git add nextmv/__about__.py
62+
git commit -m "Bump version to $VERSION"
63+
git push

nextmv/__about__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "v0.1.0.dev6"

pyproject.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ dependencies = [
1616
"requests>=2.31.0",
1717
]
1818
description = "The Python SDK for Nextmv"
19+
dynamic = [
20+
"version",
21+
]
1922
keywords = [
2023
"decision engineering",
2124
"decision science",
@@ -34,7 +37,6 @@ maintainers = [
3437
name = "nextmv"
3538
readme = "README.md"
3639
requires-python = ">=3.10"
37-
version = "0.1.0.dev4"
3840

3941
[project.urls]
4042
Homepage = "https://www.nextmv.io"
@@ -53,3 +55,6 @@ select = [
5355
"UP", # pyupgrade
5456
]
5557
line-length = 120
58+
59+
[tool.hatch.version]
60+
path = "nextmv/__about__.py"

0 commit comments

Comments
 (0)