Skip to content

Commit

Permalink
Merge pull request #7 from hermes-hmc/Add-autoincrement-version
Browse files Browse the repository at this point in the history
Added autoincrement for the version number
  • Loading branch information
led02 authored Jul 19, 2024
2 parents d445970 + 2e763ad commit 5b8a219
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 35 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ jobs:
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
run: |
python increment_version.py
python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
Expand Down
25 changes: 25 additions & 0 deletions increment_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import toml

def main():
with open("pyproject.toml", 'r+') as f:
data = toml.load(f)
project = data.get("project")
if not project is None:
version = project.get("version")
if not version is None:
a,b,c = map(int, version.split("."))
if c < 99:
c += 1
elif b < 99:
c = 0
b += 1
else:
c = 0
b = 0
a += 1
data["project"]["version"] = str(a) + "." + str(b) + "." + str(c)
if not data == {}:
with open("pyproject.toml", 'w') as f:
toml.dump(data, f)

main()
54 changes: 20 additions & 34 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,53 +1,39 @@
# SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR)
#
# SPDX-License-Identifier: CC0-1.0

# SPDX-FileContributor: Michael Meinel
# SPDX-FileContributor: Michael Fritzsche

[build-system]
requires = ["setuptools >= 70.1.1"]
requires = [ "setuptools >= 70.1.1",]
build-backend = "setuptools.build_meta"

[project]
name = "hermes-plugin-python"
dynamic = ["version"]
license = {text = "Apache-2.0"}
version = "0.1.0"
readme = "README.md"
authors = [
{name = "Michael Meinel", email = "[email protected]"},
{name = "Michael Fritzsche"},
]
description = "HERMES plugin for .toml files"
keywords = ["publishing", "metadata", "automation"]
keywords = [ "publishing", "metadata", "automation",]
requires-python = ">= 3.12.4"
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Environment :: Plugins",
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
]
dependencies = [
"hermes>=0.8.0",
]
classifiers = [ "Development Status :: 2 - Pre-Alpha", "Environment :: Plugins", "Programming Language :: Python :: 3", "Operating System :: OS Independent",]
dependencies = [ "hermes>=0.8.0",]
[[project.authors]]
name = "Michael Meinel"
email = "[email protected]"

[[project.authors]]
name = "Michael Fritzsche"

[project.license]
text = "Apache-2.0"

[project.optional-dependencies]
dev = [
"pytest>=8.2.2",
"pytest-cov>=3.0.0",
"taskipy>=1.10.3",
"flake8>=5.0.4",
"reuse>=1.1.2",
]
dev = [ "pytest>=8.2.2", "pytest-cov>=3.0.0", "taskipy>=1.10.3", "flake8>=5.0.4", "reuse>=1.1.2",]

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

[tool.setuptools]
packages = [ "hermes_toml",]

[project.entry-points."hermes.harvest"]
cff = "hermes.commands.harvest.cff:CffHarvestPlugin"
codemeta = "hermes.commands.harvest.codemeta:CodeMetaHarvestPlugin"
toml = "hermes_toml.harvest:TomlHarvestPlugin"

[tool.setuptools]
packages = ["hermes_toml"]
package-dir = {"" = "src"}
[tool.setuptools.package-dir]
"" = "src"

0 comments on commit 5b8a219

Please sign in to comment.