Skip to content

Commit

Permalink
Improve version handling (#15)
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 3450bc4 commit eec85f9
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\"" ./docker2mqtt/__init__.py; then
if ! grep -q "__version__ = \"$TAG_VERSION\"" ./docker2mqtt/__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 docker2mqtt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""docker2mqtt package."""

__VERSION__ = "2.0.5"
__version__ = "2.0.5"

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

from docker2mqtt.helpers import clean_for_discovery

from . import __VERSION__
from . import __version__
from .const import (
ANSI_ESCAPE,
DESTROYED_CONTAINER_TTL_DEFAULT,
Expand Down Expand Up @@ -118,7 +118,7 @@ class Docker2Mqtt:
"""

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

cfg: Docker2MqttConfig

Expand Down Expand Up @@ -1193,7 +1193,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
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = docker2mqtt
version = 2.0.5
version = attr: docker2mqtt.__version__
author = Cyrill Raccaud
author_email = [email protected]
description = Send your docker stats and and events to mqtt and discovery them in home assistant.
Expand Down

0 comments on commit eec85f9

Please sign in to comment.