Debian Codegraph @

scripts/set-version

raw
1 #!/bin/sh
2
3 # script/set-version: Update the version in pyproject.toml
4
5 set -e
6
7 cd "$(dirname "$0")/.."
8
9 if [ -z "$1" ]; then
10 echo "Error: Version argument is required"
11 echo "Usage: scripts/set-version <version>"
12 echo "Example: scripts/set-version 1.2.3"
13 exit 1
14 fi
15
16 VERSION="$1"
17
18 echo "==> Updating version to $VERSION..."
19
20 if [ -f "pyproject.toml" ]; then
21 sed -i "s/^version = .*/version = \"$VERSION\"/" pyproject.toml
22 echo "==> Updated pyproject.toml"
23 else
24 echo "Error: pyproject.toml not found"
25 exit 1
26 fi
27
28 if grep -q "version = \"$VERSION\"" pyproject.toml; then
29 echo "==> Version successfully updated to $VERSION"
30 else
31 echo "Error: Failed to update version"
32 exit 1
33 fi