Skip to content

Commit 0dd3e69

Browse files
Merge pull request #97 from ivanildobarauna-dev/hotfix/update-otel-wrapper
hotfix: update otel-wrapper
2 parents a5b883c + 43880c7 commit 0dd3e69

File tree

4 files changed

+120
-82
lines changed

4 files changed

+120
-82
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,8 @@ repos:
77

88
# - repo: local
99
# hooks:
10-
# - id: pylint
11-
# name: pylint
12-
# entry: pylint
13-
# language: system
14-
# types: [python]
15-
# args:
16-
# [
17-
# "-rn", # Only display messages
18-
# "--disable=C0114,C0115,C0116, R0903",
19-
# ]
20-
21-
# - repo: local
22-
# hooks:
23-
# - id: version-inc
24-
# name: Version Increase
25-
# entry: ./version_increment.sh
26-
# language: script
27-
# files: .*
10+
# - id: version-inc
11+
# name: Version Increase
12+
# entry: ./auto_version_bump.sh
13+
# language: script
14+
# files: .*

auto_version_bump.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
# Function to display error messages and exit
6+
error_exit() {
7+
echo "ERROR: $1" >&2
8+
exit 1
9+
}
10+
11+
# Check if pyproject.toml exists
12+
if [[ ! -f pyproject.toml ]]; then
13+
error_exit "pyproject.toml not found in the current directory"
14+
fi
15+
16+
# Check if git repo exists
17+
if ! git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
18+
error_exit "Not inside a git repository"
19+
fi
20+
21+
echo "Checking if version needs to be bumped..."
22+
23+
# Function to extract version from pyproject.toml
24+
get_version() {
25+
grep -E "^version\\s*=\\s*[\\"']" pyproject.toml | sed -E 's/version\\s*=\\s*["'\''](^["'\'']+)["'\''].*/\\1/'
26+
}
27+
28+
# Check if pyproject.toml is staged
29+
if git diff --name-only --cached | grep -q "pyproject.toml"; then
30+
echo "pyproject.toml is staged. Checking if version has been modified..."
31+
32+
# Get the current version in the working copy
33+
current_version=$(get_version)
34+
35+
# Get the version from the last commit
36+
previous_version=$(git show HEAD:pyproject.toml 2>/dev/null | grep -E "^version\\s*=\\s*[\\"']" | sed -E 's/version\\s*=\\s*["'\''](^["'\'']+)["'\''].*/\\1/' || echo "")
37+
38+
if [[ "$current_version" != "$previous_version" ]]; then
39+
echo "Version has already been changed from $previous_version to $current_version. No need to bump version."
40+
exit 0
41+
fi
42+
fi
43+
44+
# If we get here, we need to bump the version
45+
echo "Bumping patch version..."
46+
poetry version patch || error_exit "Failed to bump version with poetry"
47+
48+
new_version=$(get_version)
49+
echo "Version bumped to $new_version"
50+
51+
# Stage the changes to pyproject.toml
52+
git add pyproject.toml || error_exit "Failed to stage pyproject.toml"
53+
54+
echo "Successfully bumped version and staged pyproject.toml"
55+
exit 0

poetry.lock

Lines changed: 58 additions & 62 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)