bal-chatbot / .github /workflows /deploy.yml
brk9999's picture
Upload folder using huggingface_hub
eaba48f verified
Raw
History Blame Contribute Delete
1.12 kB
name: Sync to Hugging Face hub
on:
push:
branches: [main] # GitHub'daki ana branch adın master ise burayı master yap
workflow_dispatch:
jobs:
sync-to-hub:
runs-on: ubuntu-latest
steps:
- name: Checkout GitHub Repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Hugging Face Hub CLI
run: pip install 'huggingface_hub==0.26.0'
- name: Direct Upload to Hugging Face Space
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
# Official Hugging Face API method — bypasses Git hooks entirely
python -c "
import os
from huggingface_hub import HfApi
api = HfApi(token=os.environ['HF_TOKEN'])
print('Hugging Face API connected. Starting upload...')
api.upload_folder(
folder_path='.',
repo_id='brk9999/bal-chatbot',
repo_type='space',
)
print('Upload completed successfully!')
"