Skip to content

Commit 6c9677f

Browse files
committed
feat(scripts): add bump-version.sh script to automate version updates
build(Cargo.toml): update `Cargo.toml` version to `1.0.9`
1 parent e8bf637 commit 6c9677f

2 files changed

Lines changed: 48 additions & 1 deletion

File tree

scripts/bump-version.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
# bump-version.sh - Updates version across all project files
3+
# Usage: ./scripts/bump-version.sh <version>
4+
# Example: ./scripts/bump-version.sh 1.1.0
5+
6+
set -euo pipefail
7+
8+
VERSION="${1:?Usage: bump-version.sh <version>}"
9+
10+
# Strip leading 'v' if present
11+
VERSION="${VERSION#v}"
12+
13+
# Validate version format (semver: X.Y.Z with optional prerelease)
14+
if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+'; then
15+
echo "Error: Invalid version format '$VERSION'. Expected semver (e.g., 1.1.0)"
16+
exit 1
17+
fi
18+
19+
echo "Bumping version to ${VERSION}..."
20+
21+
# 1. package.json
22+
if [ -f "package.json" ]; then
23+
if command -v jq &> /dev/null; then
24+
jq --arg v "$VERSION" '.version = $v' package.json > package.json.tmp && mv package.json.tmp package.json
25+
else
26+
sed -i.bak "s|\"version\": \"[^\"]*\"|\"version\": \"${VERSION}\"|" package.json && rm -f package.json.bak
27+
fi
28+
echo " ✓ package.json -> ${VERSION}"
29+
fi
30+
31+
# 2. src-tauri/tauri.conf.json
32+
if [ -f "src-tauri/tauri.conf.json" ]; then
33+
if command -v jq &> /dev/null; then
34+
jq --arg v "$VERSION" '.version = $v' src-tauri/tauri.conf.json > src-tauri/tauri.conf.json.tmp && mv src-tauri/tauri.conf.json.tmp src-tauri/tauri.conf.json
35+
else
36+
sed -i.bak "s|\"version\": \"[^\"]*\"|\"version\": \"${VERSION}\"|" src-tauri/tauri.conf.json && rm -f src-tauri/tauri.conf.json.bak
37+
fi
38+
echo " ✓ src-tauri/tauri.conf.json -> ${VERSION}"
39+
fi
40+
41+
# 3. src-tauri/Cargo.toml (use | delimiter to avoid issues with / in paths)
42+
if [ -f "src-tauri/Cargo.toml" ]; then
43+
sed -i.bak "s|^version = \".*\"|version = \"${VERSION}\"|" src-tauri/Cargo.toml && rm -f src-tauri/Cargo.toml.bak
44+
echo " ✓ src-tauri/Cargo.toml -> ${VERSION}"
45+
fi
46+
47+
echo "Done! All files bumped to ${VERSION}"

src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "zero-limit"
3-
version = "1.0.0"
3+
version = "1.0.9"
44
description = "ZeroLimit AI Coding Assistant Quota Tracker"
55
authors = ["0xtbug"]
66
edition = "2021"

0 commit comments

Comments
 (0)