#!/bin/bash
echo "⚡ Syncing Sovereign Stack to GitHub..."
git add .
git commit -m "Auto-Update: $(date)"
git push origin main

echo "📦 Creating Sovereign Release & Uploading APK..."
VERSION="v$(date +%Y%m%d%H%M)"
# Find the APK generated by Buildozer
APK_PATH=$(find bin/ -name "*.apk" | head -n 1)

if [ -f "$APK_PATH" ]; then
    gh release create "$VERSION" "$APK_PATH" --title "Reech Core $VERSION" --notes "Autonomous Build Successful."
    echo "🔱 RELEASE LIVE: $(gh release view "$VERSION" --json url -q .url)"
else
    echo "❌ Error: No APK found in bin/. Forge the binary first."
fi
