Skip to content

Commit 5b8a219

Browse files
authored
Merge pull request #7 from hermes-hmc/Add-autoincrement-version
Added autoincrement for the version number
2 parents d445970 + 2e763ad commit 5b8a219

File tree

3 files changed

+48
-35
lines changed

3 files changed

+48
-35
lines changed

.github/workflows/python-publish.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ jobs:
3434
python -m pip install --upgrade pip
3535
pip install build
3636
- name: Build package
37-
run: python -m build
37+
run: |
38+
python increment_version.py
39+
python -m build
3840
- name: Publish package
3941
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
4042
with:

increment_version.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import toml
2+
3+
def main():
4+
with open("pyproject.toml", 'r+') as f:
5+
data = toml.load(f)
6+
project = data.get("project")
7+
if not project is None:
8+
version = project.get("version")
9+
if not version is None:
10+
a,b,c = map(int, version.split("."))
11+
if c < 99:
12+
c += 1
13+
elif b < 99:
14+
c = 0
15+
b += 1
16+
else:
17+
c = 0
18+
b = 0
19+
a += 1
20+
data["project"]["version"] = str(a) + "." + str(b) + "." + str(c)
21+
if not data == {}:
22+
with open("pyproject.toml", 'w') as f:
23+
toml.dump(data, f)
24+
25+
main()

pyproject.toml

Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,39 @@
1-
# SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR)
2-
#
3-
# SPDX-License-Identifier: CC0-1.0
4-
5-
# SPDX-FileContributor: Michael Meinel
6-
# SPDX-FileContributor: Michael Fritzsche
7-
81
[build-system]
9-
requires = ["setuptools >= 70.1.1"]
2+
requires = [ "setuptools >= 70.1.1",]
103
build-backend = "setuptools.build_meta"
114

125
[project]
136
name = "hermes-plugin-python"
14-
dynamic = ["version"]
15-
license = {text = "Apache-2.0"}
7+
version = "0.1.0"
168
readme = "README.md"
17-
authors = [
18-
{name = "Michael Meinel", email = "michael.meinel@dlr.de"},
19-
{name = "Michael Fritzsche"},
20-
]
219
description = "HERMES plugin for .toml files"
22-
keywords = ["publishing", "metadata", "automation"]
10+
keywords = [ "publishing", "metadata", "automation",]
2311
requires-python = ">= 3.12.4"
24-
classifiers = [
25-
"Development Status :: 2 - Pre-Alpha",
26-
"Environment :: Plugins",
27-
"Programming Language :: Python :: 3",
28-
"Operating System :: OS Independent",
29-
]
30-
dependencies = [
31-
"hermes>=0.8.0",
32-
]
12+
classifiers = [ "Development Status :: 2 - Pre-Alpha", "Environment :: Plugins", "Programming Language :: Python :: 3", "Operating System :: OS Independent",]
13+
dependencies = [ "hermes>=0.8.0",]
14+
[[project.authors]]
15+
name = "Michael Meinel"
16+
email = "michael.meinel@dlr.de"
17+
18+
[[project.authors]]
19+
name = "Michael Fritzsche"
20+
21+
[project.license]
22+
text = "Apache-2.0"
3323

3424
[project.optional-dependencies]
35-
dev = [
36-
"pytest>=8.2.2",
37-
"pytest-cov>=3.0.0",
38-
"taskipy>=1.10.3",
39-
"flake8>=5.0.4",
40-
"reuse>=1.1.2",
41-
]
25+
dev = [ "pytest>=8.2.2", "pytest-cov>=3.0.0", "taskipy>=1.10.3", "flake8>=5.0.4", "reuse>=1.1.2",]
4226

4327
[project.urls]
4428
Repository = "https://github.com/hermes-hmc/hermes-plugin-python"
4529

30+
[tool.setuptools]
31+
packages = [ "hermes_toml",]
32+
4633
[project.entry-points."hermes.harvest"]
4734
cff = "hermes.commands.harvest.cff:CffHarvestPlugin"
4835
codemeta = "hermes.commands.harvest.codemeta:CodeMetaHarvestPlugin"
4936
toml = "hermes_toml.harvest:TomlHarvestPlugin"
5037

51-
[tool.setuptools]
52-
packages = ["hermes_toml"]
53-
package-dir = {"" = "src"}
38+
[tool.setuptools.package-dir]
39+
"" = "src"

0 commit comments

Comments
 (0)