name: Sync to Hugging Face Hub on: push: branches: [main] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: jobs: sync-to-hub: runs-on: ubuntu-latest steps: - name: Checkout Repository uses: actions/checkout@v4 with: fetch-depth: 0 lfs: true - name: Pull LFS objects run: | git lfs install git lfs pull - name: Push to Hub env: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: | # Remove the folders Hugging Face does not want (but GitHub will keep) rm -rf assets/ rm -rf reports/ # Delete temporary runner's git history rm -rf .git/ # Reinitialize a brand new history for HF (does not affect GitHub) git init git branch -M main # Create a temporary git identity git config user.name "github-actions" git config user.email "actions@github.com" # Finalize and push git lfs install git add . git commit -m "Clean sync: code and weights only." # Push flat history to HF git push --force https://lxtung95:$HF_TOKEN@huggingface.co/lxtung95/lyricloop-llm main