umer6016 commited on
Commit
7e8debe
·
1 Parent(s): 17cfb2c

Fix Deployment: Switch to Clone-Copy-Push strategy

Browse files
Files changed (1) hide show
  1. .github/workflows/deploy_to_hf.yml +19 -1
.github/workflows/deploy_to_hf.yml CHANGED
@@ -19,4 +19,22 @@ jobs:
19
  env:
20
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
21
  run: |
22
- git push -f https://umer6016:$HF_TOKEN@huggingface.co/spaces/umer6016/Stockker main
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  env:
20
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
21
  run: |
22
+ # Configure Git
23
+ git config --global user.email "action@github.com"
24
+ git config --global user.name "GitHub Action"
25
+
26
+ # 1. Clone the HF Repo specifically
27
+ git clone https://umer6016:$HF_TOKEN@huggingface.co/spaces/umer6016/Stockker hf_space
28
+ cd hf_space
29
+
30
+ # 2. Delete everything in HF repo (to ensure clean slate) except .git
31
+ # (We use find to avoid error if empty)
32
+ find . -maxdepth 1 -not -name '.git' -not -name '.' -exec rm -rf {} +
33
+
34
+ # 3. Copy files from our GitHub repo (parent dir) to here
35
+ cp -r ../* .
36
+
37
+ # 4. Add, Commit, Push
38
+ git add .
39
+ git commit -m "Deploy from GitHub Actions" --allow-empty
40
+ git push https://umer6016:$HF_TOKEN@huggingface.co/spaces/umer6016/Stockker main