-
Notifications
You must be signed in to change notification settings - Fork 0
36 lines (30 loc) · 1.12 KB
/
Copy pathdeploy-to-hf.yml
File metadata and controls
36 lines (30 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: Deploy Backend to Hugging Face
on:
push:
branches:
- main
paths:
- 'backend/**'
workflow_dispatch: # Allows you to manually trigger it from the Actions tab
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Needed for subtree split
lfs: true # Fetch LFS files like YOLO model weights
- name: Push to Hugging Face
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
# Set up git
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
# Add Hugging Face as a remote
git remote add hf https://chinmaygawad:$HF_TOKEN@huggingface.co/spaces/chinmaygawad/nutrivision-backend
# Create a new branch containing ONLY the contents of the "backend" directory
git subtree split --prefix backend -b hf-deploy
# Push that branch to the "main" branch of your Hugging Face Space
git push --force hf hf-deploy:main