oppo-node / scripts /push_to_huggingface.sh
DJ-Goanna-Coding's picture
Deploy from GitHub Actions
c87f72b verified
#!/bin/bash
# Push VAMGUARD_TITAN to HuggingFace repository
set -e
echo "================================================"
echo "πŸ“€ Pushing to HuggingFace: DJ-Goanna-Coding"
echo "================================================"
echo ""
# Check if HF_TOKEN is set
if [ -z "$HF_TOKEN" ]; then
echo "⚠️ HF_TOKEN environment variable not set"
echo " Please set your HuggingFace token:"
echo " export HF_TOKEN='your_token_here'"
exit 1
fi
echo "βœ… HF_TOKEN found"
echo ""
# Get repository info
REPO_NAME="VAMGUARD_TITAN"
HF_USERNAME="DJ-Goanna-Coding"
HF_SPACE_NAME="TIA-ARCHITECT-CORE"
echo "πŸ“‹ Repository Information:"
echo " GitHub Repo: DJ-Goana-Coding/$REPO_NAME"
echo " HF Username: $HF_USERNAME"
echo " HF Space: $HF_SPACE_NAME"
echo ""
# Check if we're in a git repository
if [ ! -d .git ]; then
echo "❌ Not in a git repository"
exit 1
fi
echo "βœ… Git repository detected"
echo ""
# Add HuggingFace remote if it doesn't exist
HF_REMOTE_URL="https://huggingface.co/spaces/$HF_USERNAME/$HF_SPACE_NAME"
if git remote get-url huggingface 2>/dev/null; then
echo "πŸ“‘ HuggingFace remote already exists"
git remote set-url huggingface "$HF_REMOTE_URL"
else
echo "πŸ“‘ Adding HuggingFace remote"
git remote add huggingface "$HF_REMOTE_URL"
fi
echo " Remote URL: $HF_REMOTE_URL"
echo ""
# Get current branch
CURRENT_BRANCH=$(git branch --show-current)
echo "🌿 Current branch: $CURRENT_BRANCH"
echo ""
# Show what will be pushed
echo "πŸ“Š Files to be pushed:"
git ls-files | head -20
echo " ... and more"
echo ""
# Confirm push
read -p "πŸš€ Push to HuggingFace? (y/N): " -n 1 -r
echo ""
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "❌ Push cancelled"
exit 0
fi
echo ""
echo "πŸš€ Pushing to HuggingFace..."
echo ""
# Configure git to use token
git config --local credential.helper store
# Push to HuggingFace
git push huggingface $CURRENT_BRANCH:main --force
echo ""
echo "================================================"
echo "βœ… Successfully pushed to HuggingFace!"
echo "================================================"
echo ""
echo "🌐 View your space at:"
echo " https://huggingface.co/spaces/$HF_USERNAME/$HF_SPACE_NAME"
echo ""
echo "πŸ“ Note: It may take a few minutes for HuggingFace to rebuild your space"
echo ""