-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·65 lines (52 loc) · 2.61 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·65 lines (52 loc) · 2.61 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
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env bash
set -e
# Build script: runs tests, bumps patch version, then builds.
# Usage: ./build.sh
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"
echo "══════════════════════════════════════════════"
echo " Grafium - Build Pipeline"
echo "══════════════════════════════════════════════"
# ─── 1. Run Rust tests ────────────────────────────
echo ""
echo "▶ Running Rust tests..."
cargo test --workspace 2>&1
if [ $? -ne 0 ]; then
echo "✗ Tests failed. Build aborted."
exit 1
fi
echo "✓ All Rust tests passed."
# ─── 2. Bump version (patch/build) ───────────────
echo ""
echo "▶ Bumping patch/build version..."
# Read current version from workspace Cargo.toml
CURRENT_VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
# Parse major.minor.patch and increment patch like Windows build number
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION"
NEW_PATCH=$((PATCH + 1))
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
echo " $CURRENT_VERSION → $NEW_VERSION"
# Update all version references
sed -i "s/^version = \"$CURRENT_VERSION\"/version = \"$NEW_VERSION\"/" Cargo.toml
sed -i "0,/^version = \"$CURRENT_VERSION\"/s//version = \"$NEW_VERSION\"/" ui/src-tauri/Cargo.toml
sed -i "s/\"version\": \"$CURRENT_VERSION\"/\"version\": \"$NEW_VERSION\"/" ui/src-tauri/tauri.conf.json
sed -i "s/\"version\": \"$CURRENT_VERSION\"/\"version\": \"$NEW_VERSION\"/" ui/package.json
echo "✓ Version bumped to $NEW_VERSION"
# ─── 3. Build frontend ───────────────────────────
echo ""
echo "▶ Building frontend..."
cd ui
npm run build 2>&1
cd ..
echo "✓ Frontend build complete."
# ─── 4. Build Rust backend (embeds frontend dist) ─
echo ""
echo "▶ Building Rust backend..."
cargo build --release 2>&1
echo "✓ Rust build complete."
# ─── 5. Done ─────────────────────────────────────
echo ""
echo "══════════════════════════════════════════════"
echo " ✓ Build successful - v$NEW_VERSION"
echo " Binary: target/release/grafium"
echo "══════════════════════════════════════════════"