UdasriHasindu commited on
Commit
cccd364
·
1 Parent(s): 2c47f90

action: implement deployement action on HF

Browse files
Files changed (1) hide show
  1. .github/workflows/deploy.yml +32 -0
.github/workflows/deploy.yml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Deploy to Hugging Face Spaces
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ deploy:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - name: Checkout repository
14
+ uses: actions/checkout@v4
15
+ with:
16
+ fetch-depth: 0 # full history so git push carries all commits
17
+
18
+ - name: Push to Hugging Face Space
19
+ env:
20
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
21
+ HF_SPACE: ${{ secrets.HF_SPACE }} # e.g. xplorers/UPDRS_API
22
+ run: |
23
+ git config user.email "github-actions@github.com"
24
+ git config user.name "GitHub Actions"
25
+
26
+ # Add the HF Space as a remote (uses token for auth)
27
+ git remote add hf_space \
28
+ "https://user:${HF_TOKEN}@huggingface.co/spaces/${HF_SPACE}"
29
+
30
+ # Force-push current branch to HF Space main
31
+ # HF rebuilds the Docker container on every push
32
+ git push hf_space HEAD:main --force