mirror of
https://github.com/daylinmorgan/viv.git
synced 2024-12-22 10:40:44 -06:00
chore: add back version setter as post-commit hook
This commit is contained in:
parent
94bc35147a
commit
763bb2f844
2 changed files with 16 additions and 10 deletions
|
@ -1,5 +1,9 @@
|
||||||
# See https://pre-commit.com for more information
|
# See https://pre-commit.com for more information
|
||||||
# See https://pre-commit.com/hooks.html for more hooks
|
# See https://pre-commit.com/hooks.html for more hooks
|
||||||
|
default_install_hook_types:
|
||||||
|
- pre-commit
|
||||||
|
- post-commit
|
||||||
|
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 23.3.0
|
rev: 23.3.0
|
||||||
|
@ -11,10 +15,11 @@ repos:
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
|
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
|
||||||
# - repo: local
|
- repo: local
|
||||||
# hooks:
|
hooks:
|
||||||
# - id: set-version
|
- id: set-version
|
||||||
# language: script
|
language: script
|
||||||
# name: sets __version__ in viv.py
|
name: sets __version__ in viv.py
|
||||||
# entry: ./scripts/bump-dev.sh
|
entry: ./scripts/bump-dev.sh
|
||||||
# files: viv.py$
|
stages: [post-commit]
|
||||||
|
always_run: true
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env bash
|
||||||
TAG=$(git describe --tags --always --dirty=-dev)
|
TAG=$(git describe --tags --always --dirty=-dev)
|
||||||
VERSION="${TAG#v}"
|
VERSION="${TAG#v}"
|
||||||
|
if [[ "$(git diff --name-only HEAD HEAD~1)" == *"./src/viv/viv.py"* ]]; then
|
||||||
sed -i "s/__version__ = \".*\"/__version__ = \"$VERSION\"/g" src/viv/viv.py
|
sed -i "s/__version__ = \".*\"/__version__ = \"$VERSION\"/g" src/viv/viv.py
|
||||||
git add src/viv/viv.py
|
fi
|
||||||
|
|
Loading…
Reference in a new issue