diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index cdcb69c..1b95b7d 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -32,10 +32,15 @@ jobs: run: | python -m pip install --upgrade pip pip install build - - name: Set version + - name: install envsubts run: | - VERSION=${GITHUB_REF#refs/tags/} - sed -i "s/version='0.0.0',/version='$VERSION',/" setup.py + if [ "$(id -u)" = 0 ]; then export SUDO=""; else # Check if we're root + export SUDO="sudo"; + fi + command -v gettext >/dev/null 2>&1 || { $SUDO apt -qq update && $SUDO apt -qq install -y gettext; } + - name: substitute env vars + run: | + envsubst < setup.py > setup.py-tmp && mv setup.py-tmp setup.py - name: Build package run: python -m build - name: Publish package diff --git a/setup.py b/setup.py index 6f440fe..1abcf40 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name = 'pytouchline_extended', packages = ['pytouchline_extended'], - version = '0.0.0', + version = "$GITHUB_REF_NAME", description = 'A Roth Touchline interface library', long_description="A simple helper library for controlling a Roth Touchline heat pump controller", author = 'Peter Brondum',