ai-engineering-project / .github /workflows /sync-huggingface.yml
GitHub Action
Clean deployment without binary files
f884e6e
# Manual sync workflow for emergency deployments or testing
# The main CI/CD pipeline (main.yml) now deploys directly to Hugging Face Spaces
# This file can be used for manual syncing if needed
name: Manual Sync to Hugging Face (Emergency Only)
on:
workflow_dispatch:
inputs:
force_sync:
description: 'Force sync even if there are no changes'
required: false
default: 'false'
space_id:
description: 'HF Space ID (optional override)'
required: false
default: 'msse-team-3/ai-engineering-project'
jobs:
manual-sync:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
- name: Manual Push to Hugging Face Space
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
SPACE_ID: ${{ github.event.inputs.space_id || 'msse-team-3/ai-engineering-project' }}
run: |
git config --global user.email "action@github.com"
git config --global user.name "GitHub Action (Manual Sync)"
# Add Hugging Face remote
git remote add hf https://user:$HF_TOKEN@huggingface.co/spaces/$SPACE_ID
# Push to Hugging Face
git push --force hf main
echo "✅ Manual sync to Hugging Face Space completed!"
- name: Create sync summary
if: success()
env:
SPACE_ID: ${{ github.event.inputs.space_id || 'msse-team-3/ai-engineering-project' }}
run: |
echo "## 🚀 Manual Hugging Face Sync Complete" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Space**: https://huggingface.co/spaces/$SPACE_ID" >> $GITHUB_STEP_SUMMARY
echo "**Branch**: main" >> $GITHUB_STEP_SUMMARY
echo "**Commit**: $GITHUB_SHA" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "⚠️ **Note**: Regular deployments should use the main CI/CD pipeline"
echo "Successfully synced commit $GITHUB_SHA to Hugging Face Space" >> $GITHUB_STEP_SUMMARY
echo "- **Space URL**: https://huggingface.co/spaces/$SPACE_ID" >> $GITHUB_STEP_SUMMARY
echo "- **Synced at**: $(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_STEP_SUMMARY