Private
Public Access
1
0
Files
linux_patch_manager/scripts/git-hooks/pre-push
git-echo 124b5b0e3b feat: add bump-version.sh script for version management
Automates version bumps across all version source files:
- Cargo.toml (PRIMARY - workspace.package.version)
- debian/changelog (prepend new entry)
- debian/control (update Version field)
- scripts/build-package.sh (update VERSION variable)
- frontend/package.json (update version field)
- Stale references check after bump

Usage: ./scripts/bump-version.sh <new_version> <old_version>
2026-05-28 10:52:16 -05:00

47 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# =============================================================================
# Linux Patch Manager — Pre-Push Hook
# =============================================================================
# Safety net: verifies cargo fmt, ESLint, and TypeScript pass before pushing.
# Install: ./scripts/git-hooks/install.sh
# =============================================================================
set -euo pipefail
REPO_ROOT="$(git rev-parse --show-toplevel)"
FAILED=0
# ── Rust format check ────────────────────────────────────────────────────────
if [[ -f "${REPO_ROOT}/Cargo.toml" ]]; then
echo "[pre-push] Checking Rust formatting ..."
if ! cargo fmt --all --manifest-path "${REPO_ROOT}/Cargo.toml" --check 2>/dev/null; then
echo "[pre-push] ❌ Rust formatting check FAILED. Run: cargo fmt --all"
FAILED=1
fi
fi
# ── Frontend ESLint ──────────────────────────────────────────────────────────
if [[ -f "${REPO_ROOT}/frontend/package.json" ]]; then
echo "[pre-push] Running ESLint ..."
if ! (cd "${REPO_ROOT}/frontend" && npx eslint src/ --ext .ts,.tsx --max-warnings 0 2>/dev/null); then
echo "[pre-push] ❌ ESLint check FAILED."
FAILED=1
fi
fi
# ── Frontend type check ─────────────────────────────────────────────────────
if [[ -f "${REPO_ROOT}/frontend/package.json" ]]; then
echo "[pre-push] Checking TypeScript types ..."
if ! (cd "${REPO_ROOT}/frontend" && npx tsc --noEmit 2>/dev/null); then
echo "[pre-push] ❌ TypeScript type check FAILED."
FAILED=1
fi
fi
if [[ ${FAILED} -ne 0 ]]; then
echo "[pre-push] Push rejected — fix errors above before pushing."
exit 1
fi
echo "[pre-push] All checks passed ✓"