#!/bin/bash # Create GitHub Release with Model Assets # This creates an IMMUTABLE release that serves as a permanent backup set -e echo "🧠 Creating GitHub Release with Model Assets" echo "============================================" # Configuration VERSION="models-v1.0.0" MODELS_DIR="./models" REPO="soulcraftlabs/brainy-models" # Check if models exist if [ ! -d "$MODELS_DIR/Xenova/all-MiniLM-L6-v2" ]; then echo "❌ Models not found. Run 'npm run download-models' first." exit 1 fi # Create tarball echo "📦 Creating model archive..." cd $MODELS_DIR tar -czf ../all-MiniLM-L6-v2.tar.gz Xenova/all-MiniLM-L6-v2/ cd .. # Calculate hashes echo "🔐 Calculating SHA256 hash..." HASH=$(sha256sum all-MiniLM-L6-v2.tar.gz | cut -d' ' -f1) SIZE=$(stat -c%s all-MiniLM-L6-v2.tar.gz 2>/dev/null || stat -f%z all-MiniLM-L6-v2.tar.gz) SIZE_MB=$((SIZE / 1048576)) echo " File: all-MiniLM-L6-v2.tar.gz" echo " Size: ${SIZE_MB}MB" echo " SHA256: $HASH" # Create release notes cat > release-notes.md </dev/null || true # Create the release with the model as an asset gh release create $VERSION \ --repo $REPO \ --title "Brainy Models v1.0.0 - IMMUTABLE" \ --notes-file release-notes.md \ --verify-tag \ all-MiniLM-L6-v2.tar.gz echo "✅ Release created successfully!" echo "" echo "📍 Release URL: https://github.com/${REPO}/releases/tag/${VERSION}" echo "📦 Download URL: https://github.com/${REPO}/releases/download/${VERSION}/all-MiniLM-L6-v2.tar.gz" echo "🔒 SHA256: $HASH" echo "" echo "This release is now immutable and will serve as a permanent backup." echo "The download URL can be used in the Brainy fallback chain." # Update our model manager with the correct URL echo "" echo "To update Brainy with this URL, add to src/critical/model-guardian.ts:" echo " url: 'https://github.com/${REPO}/releases/download/${VERSION}/all-MiniLM-L6-v2.tar.gz'" # Clean up rm all-MiniLM-L6-v2.tar.gz rm release-notes.md