Skip to content

Commit

Permalink
Improve version handling (#9)
Browse files Browse the repository at this point in the history
single point of truth for version
  • Loading branch information
miaucl authored Sep 19, 2024
1 parent 5947e3b commit f72fe95
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
11 changes: 1 addition & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,13 @@ jobs:
- name: Check tag in package
run: |
if ! grep -q "__VERSION__ = \"$TAG_VERSION\"" ./systemctl2mqtt/__init__.py; then
if ! grep -q "__version__ = \"$TAG_VERSION\"" ./systemctl2mqtt/__init__.py; then
echo "Error: Tag version $TAG_VERSION not found in the package."
exit 1
else
echo "Success: Tag version $TAG_VERSION found in package."
fi
- name: Check tag in setup.cfg
run: |
if ! grep -q "version = $TAG_VERSION" setup.cfg; then
echo "Error: Tag version $TAG_VERSION not found in the setup.cfg."
exit 1
else
echo "Success: Tag version $TAG_VERSION found in setup.cfg."
fi
- name: Check changelog entry
run: |
if [ github.ref =~ 'refs/tags/[0-9]+\\.[0-9]+\\.[0-9]+$' ]; then
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = systemctl2mqtt
version = 1.1.2
version = attr: systemctl2mqtt.__version__
author = Cyrill Raccaud
author_email = [email protected]
description = Send your systemctl stats and and events to mqtt and discovery them in home assistant.
Expand Down
2 changes: 1 addition & 1 deletion systemctl2mqtt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""systemctl2mqtt package."""

__VERSION__ = "1.1.2"
__version__ = "1.1.2"

from .const import (
ANSI_ESCAPE,
Expand Down
6 changes: 3 additions & 3 deletions systemctl2mqtt/systemctl2mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import paho.mqtt.client

from . import __VERSION__
from . import __version__
from .const import (
ANSI_ESCAPE,
DESTROYED_SERVICE_TTL_DEFAULT,
Expand Down Expand Up @@ -119,7 +119,7 @@ class Systemctl2Mqtt:
"""

# Version
version: str = __VERSION__
version: str = __version__

cfg: Systemctl2MqttConfig

Expand Down Expand Up @@ -1129,7 +1129,7 @@ def main() -> None:
"""
parser = argparse.ArgumentParser()
parser.add_argument(
"--version", action="version", version=f"%(prog)s {__VERSION__}"
"--version", action="version", version=f"%(prog)s {__version__}"
)
parser.add_argument(
"--name",
Expand Down

0 comments on commit f72fe95

Please sign in to comment.