GitHub Action
Clean deployment - 0 binaries
39b5ef2
name: Sync to Hugging Face
on:
push:
branches: [main]
# to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
sync-to-hub:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
- name: Push to hub
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
# 1. Use a temporary directory outside the project
DEPLOY_DIR="../deploy_dir"
mkdir -p "$DEPLOY_DIR"
# 2. Copy current files to the temp directory
cp -r . "$DEPLOY_DIR/"
# 3. Enter the temp dir and wipe images
cd "$DEPLOY_DIR"
rm -rf .git
rm -rf services/frontend-service/static/images/*.png
rm -rf services/frontend-service/static/images/*.svg
rm -f .gitattributes
# 4. Initialize a FRESH git repo and set branch to 'main'
git init
git checkout -b main
git config user.name "GitHub Action"
git config user.email "action@github.com"
# 5. Create a dummy file to keep the images folder structure
mkdir -p services/frontend-service/static/images
touch services/frontend-service/static/images/.gitkeep
# 6. Commit everything
git add .
git commit -m "Clean deployment - 0 binaries"
# 7. Force push to HF
git push --force https://x-token:$HF_TOKEN@huggingface.co/spaces/Josedavison/AceNow main