name: Sync to Hugging Face Hub on: push: branches: [main] workflow_dispatch: jobs: sync-to-hub: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: fetch-depth: 0 lfs: true - name: Configure Git user run: | git config --global user.email "alexandru.dumitrescu@gmail.com" git config --global user.name "climateexploer" - name: Install Git LFS run: | sudo apt-get update sudo apt-get install git-lfs git lfs install - name: Track data folder with Git LFS run: | tracked=false if ! git lfs track --list | grep -Fq "data/**"; then git lfs track "data/**" tracked=true fi if [ "$tracked" = true ]; then git add .gitattributes git commit -m "Configure Git LFS for data folder" fi - name: Add and commit any changes run: | git add . git diff-index --quiet HEAD || git commit -m "Sync data files for Hugging Face" - name: Push to Hugging Face env: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: | git push -f https://climateexploer:$HF_TOKEN@huggingface.co/spaces/climateexploer/imgw main