UdasriHasindu commited on
Commit
b92c22f
·
1 Parent(s): 1be6770

fix: actions

Browse files
Files changed (1) hide show
  1. .github/workflows/deploy.yml +21 -23
.github/workflows/deploy.yml CHANGED
@@ -1,26 +1,24 @@
1
- name: Sync to Hugging Face Spaces
 
 
 
 
 
 
2
 
3
- on:
4
- push:
5
- branches: [main, master]
6
- # Allows you to trigger this workflow manually from the Actions tab
7
- workflow_dispatch:
 
 
8
 
9
- jobs:
10
- deploy-to-space:
11
- runs-on: ubuntu-latest
12
- steps:
13
- - name: Checkout Repository
14
- uses: actions/checkout@v4
15
- with:
16
- fetch-depth: 0 # Required to grab all commit history
17
- lfs: true # Tells git to fetch those large LFS objects
18
 
19
- - name: Push to Hugging Face Hub
20
- env:
21
- HF_TOKEN: ${{ secrets.HF_TOKEN }}
22
- # Update these exact two variables below with your HF handle and Space Name!
23
- HF_USERNAME: xplorers
24
- SPACE_NAME: MIS_API
25
- run: |
26
- git push --force "https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME"
 
1
+ - name: Push to Hugging Face Hub
2
+ env:
3
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
4
+ HF_USERNAME: xplorers
5
+ SPACE_NAME: MIS_API
6
+ run: |
7
+ set -euo pipefail
8
 
9
+ - name: Push to Hugging Face Hub
10
+ env:
11
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
12
+ HF_USERNAME: xplorers
13
+ SPACE_NAME: MIS_API
14
+ run: |
15
+ set -euo pipefail
16
 
17
+ # Strip possible CR/LF just in case the secret was pasted with a trailing newline
18
+ HF_TOKEN="$(printf '%s' "$HF_TOKEN" | tr -d '\r\n')"
 
 
 
 
 
 
 
19
 
20
+ git remote remove hf 2>/dev/null || remote="https://huggingface.co/spaces/${HF_USERNAME}/${SPACE_NAME}"
21
+
22
+ # Use the token via HTTP header (no URL parsing issues)
23
+ git -c http.extraheader="Authorization: Bearer ${HF_TOKEN}" \
24
+ push --force "${remote}" HEAD:main