Spaces:
Sleeping
Sleeping
set -e | |
echo "===> Preparing PodCraft for HuggingFace Spaces <====" | |
# Check if repository is initialized | |
if [ ! -d ".git" ]; then | |
echo "Initializing git repository..." | |
git init | |
fi | |
# Set up Git LFS | |
echo "Setting up Git LFS..." | |
git lfs install | |
git lfs track "*.gif" "*.png" "*.jpg" "*.jpeg" "*.mp3" "*.mp4" "*.wav" "*.ogg" | |
git add .gitattributes | |
# Make sure we're using Dockerfile.spaces for HuggingFace | |
echo "Ensuring space.yml is configured correctly..." | |
if ! grep -q "dockerfile: Dockerfile.spaces" space.yml; then | |
echo "Updating space.yml to use Dockerfile.spaces..." | |
sed -i 's/sdk: docker/sdk: docker\ndockerfile: Dockerfile.spaces/' space.yml | |
git add space.yml | |
fi | |
# Configure git if needed | |
if ! git remote | grep -q "origin"; then | |
echo "Please enter your HuggingFace username:" | |
read username | |
git remote add origin "https://huggingface.co/spaces/$username/podcraft" | |
echo "Remote added: https://huggingface.co/spaces/$username/podcraft" | |
fi | |
# Check for large files | |
echo "Checking for large files (>100MB)..." | |
find . -type f -size +100M | while read file; do | |
echo "Warning: Large file detected: $file" | |
echo "Consider removing or excluding it from git." | |
done | |
# Remove the frontend/podcraft/build directory as it causes errors | |
echo "Removing frontend/podcraft/build from git if it exists..." | |
if [ -d "frontend/podcraft/build" ]; then | |
git rm -r --cached frontend/podcraft/build || true | |
fi | |
# Prepare for commit | |
echo "Adding files to git..." | |
git add . | |
# Commit changes | |
echo "Committing changes..." | |
git commit -m "Update PodCraft for HuggingFace Spaces" | |
# Push to HuggingFace | |
echo "Pushing to HuggingFace Spaces..." | |
echo "This may take a while depending on the size of your repository." | |
git push -u origin main | |
echo "Push completed! Check your HuggingFace Space for build progress." |