#!/bin/bash

REPO_DIR="$HOME/Documents/veza-full-stack"
VERSION_FILE="$REPO_DIR/.commit_version"

cd "$REPO_DIR" || exit 1

# Lire ou initialiser la version
if [ ! -f "$VERSION_FILE" ]; then
  echo 1 > "$VERSION_FILE"
fi

VERSION=$(cat "$VERSION_FILE")

# Ajouter, committer, pousser
git add --all
git commit -m "REFACTOR v$VERSION"
git push

# Incrémenter et sauvegarder
NEXT_VERSION=$((VERSION + 1))
echo "$NEXT_VERSION" > "$VERSION_FILE"

