name: Sync to Hugging Face hub on: push: branches: [main] workflow_dispatch: jobs: sync-to-hub: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 lfs: true - name: Prep for HF push run: | git config user.name "github-actions" git config user.email "github-actions@github.com" git checkout --orphan hf-deploy # Ensure LFS is handled in the orphan branch git lfs install # Check if pt, jsonl or image files exist and track them find . -name "*.pt" -exec git lfs track {} + find . -name "*.jsonl" -exec git lfs track {} + find . -name "*.jpg" -exec git lfs track {} + find . -name "*.png" -exec git lfs track {} + find . -name "*.webp" -exec git lfs track {} + if [ -f ".gitattributes" ]; then git add .gitattributes fi git add . git commit -m "Deploy to HF (clean history with LFS)" - name: Push to hub env: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: | git push --force https://mametarow:$HF_TOKEN@huggingface.co/spaces/mametarow/booth-pic-api.git hf-deploy:main