-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbump.sh
More file actions
53 lines (41 loc) · 1.33 KB
/
bump.sh
File metadata and controls
53 lines (41 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bash
set -euo pipefail
if [ $# -ne 1 ]; then
echo "Usage: $0 <version>"
echo "Example: $0 0.5.0"
exit 1
fi
NEW="$1"
# Validate semver-ish format
if ! [[ "$NEW" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: version must be in X.Y.Z format (got '$NEW')"
exit 1
fi
cd "$(dirname "$0")"
# Discover the current version from the core Cargo.toml (single source of truth)
OLD=$(sed -n 's/^version = "\(.*\)"/\1/p' crates/ofd-validator-core/Cargo.toml)
if [ -z "$OLD" ]; then
echo "Error: could not detect current version"
exit 1
fi
if [ "$OLD" = "$NEW" ]; then
echo "Already at $NEW — nothing to do."
exit 0
fi
echo "Bumping $OLD -> $NEW"
# --- Cargo.toml files ---
for f in crates/ofd-validator-core/Cargo.toml \
crates/ofd-validator-python/Cargo.toml \
crates/ofd-validator-js/Cargo.toml; do
sed -i "s/^version = \"$OLD\"/version = \"$NEW\"/" "$f"
done
# --- pyproject.toml ---
sed -i "s/^version = \"$OLD\"/version = \"$NEW\"/" pyproject.toml
# --- All tracked package.json files (version field + optionalDependencies) ---
git ls-files '*.json' | grep -v node_modules | grep -v package-lock | while read -r f; do
sed -i "s/\"$OLD\"/\"$NEW\"/g" "$f"
done
# --- Regenerate Cargo.lock ---
cargo update --workspace 2>/dev/null
echo "Done. Files updated:"
git diff --name-only