Skip to content

Update

Update #1

name: Deploy to Hugging Face
on:
push:
branches:
- main
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .
- name: Configure Hugging Face
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
HF_USERNAME: ${{ secrets.HF_USERNAME }}
run: |
# Install Hugging Face CLI
pip install huggingface-hub
# Login to Hugging Face
huggingface-cli login --token $HF_TOKEN --add-to-git-credential
- name: Push to Hugging Face
env:
HF_USERNAME: ${{ secrets.HF_USERNAME }}
SPACE_NAME: ${{ secrets.SPACE_NAME }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "github-actions"
# Create repository URL
REPO_URL="https://huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME"
# Add Hugging Face as a remote and push
git remote add space $REPO_URL || git remote set-url space $REPO_URL
git push -f space main