Skip to content

Commit

Permalink
feat: bump version file in pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
KarelZe committed Feb 10, 2024
1 parent 1e7b4b1 commit 81f6ccc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,12 @@ repos:
args:
- --fix
- id: ruff-format
- repo: local
hooks:
- id: bump-my-version
name: bumpy
entry: bump-version.sh
language: script
pass_filenames: false
exclude: (.pre-commit-config.yaml)
exclude: "^(references|reports)"
6 changes: 6 additions & 0 deletions bump-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
# adapted from: https://github.com/pre-commit/pre-commit/issues/1825
set -e
if git diff --exit-code origin/main -- version; then
bump-my-version bump --allow-dirty patch version --current-version `cat version`
fi
2 changes: 2 additions & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ pytest = "*"
pytest-cov = "*"
# linting
pre-commit = "*"
# versioning
bump-my-version = "*"
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.8
0.0.9

0 comments on commit 81f6ccc

Please sign in to comment.