diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1f1aa0e..9ad90db 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,4 +11,10 @@ repos: hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix, --show-fixes] - + - repo: local + hooks: + - id: set-version + language: script + name: sets __version__ in viv.py + entry: ./scripts/bump-dev.sh + files: viv.py$ diff --git a/scripts/bump-dev.sh b/scripts/bump-dev.sh new file mode 100755 index 0000000..fea0dac --- /dev/null +++ b/scripts/bump-dev.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh +TAG=$(git describe --tags --always --dirty=-dev --exclude 'latest') +VERSION="${TAG#v}" +sed -i "s/__version__ = \".*\"/__version__ = \"$VERSION\"/g" src/viv/viv.py +git add src/viv/viv.py diff --git a/src/viv/viv.py b/src/viv/viv.py index 4e44054..c392257 100755 --- a/src/viv/viv.py +++ b/src/viv/viv.py @@ -52,7 +52,7 @@ from typing import ( from urllib.error import HTTPError from urllib.request import urlopen -__version__ = "23.5a1-dev" +__version__ = "23.5a1-16-g445a523-dev" class Config: