-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbump-version.sh
More file actions
executable file
·41 lines (34 loc) · 1.14 KB
/
Copy pathbump-version.sh
File metadata and controls
executable file
·41 lines (34 loc) · 1.14 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
#!/usr/bin/env bash
set -e
PLUGIN_DIR="$(cd "$(dirname "$0")/plugins/supergraph" && pwd)"
PLUGIN_JSON="$PLUGIN_DIR/.claude-plugin/plugin.json"
MARKET_JSON="$PLUGIN_DIR/.claude-plugin/marketplace.json"
ANTIGRAVITY_JSON="$PLUGIN_DIR/plugin.json"
CODEX_JSON="$PLUGIN_DIR/.codex-plugin/plugin.json"
bump_json_version() {
python3 - "$1" "$2" <<'EOF'
import json, sys
path, ver = sys.argv[1], sys.argv[2]
d = json.load(open(path))
d['version'] = ver
json.dump(d, open(path, 'w'), indent=2, ensure_ascii=False)
print(f" {path}: {ver}")
EOF
}
current=$(python3 -c "import json; print(json.load(open('$PLUGIN_JSON'))['version'])")
if [[ -n "$1" ]]; then
new_version="$1"
else
IFS='.' read -r major minor patch <<< "$current"
new_version="$major.$minor.$((patch + 1))"
fi
# validate semver
if ! [[ "$new_version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "❌ Invalid version: $new_version (expected x.y.z)" >&2
exit 1
fi
bump_json_version "$PLUGIN_JSON" "$new_version"
bump_json_version "$MARKET_JSON" "$new_version"
bump_json_version "$ANTIGRAVITY_JSON" "$new_version"
bump_json_version "$CODEX_JSON" "$new_version"
echo "✅ $current → $new_version"