ALYYAN commited on
Commit
b1f0ee6
·
unverified ·
1 Parent(s): 2ba7e61

Update main.yaml

Browse files
Files changed (1) hide show
  1. .github/workflows/main.yaml +14 -22
.github/workflows/main.yaml CHANGED
@@ -1,6 +1,8 @@
1
- # .github/workflows/main.yml (Final, Simplified Version)
 
 
2
 
3
- name: Deploy App to Hugging Face Spaces
4
 
5
  on:
6
  push:
@@ -8,36 +10,26 @@ on:
8
  - main
9
 
10
  jobs:
11
- deploy-to-hub:
12
  runs-on: ubuntu-latest
13
 
14
  steps:
15
- # Step 1: Check out your app's source code (no LFS needed)
16
  - name: Checkout repository
17
  uses: actions/checkout@v4
 
 
18
 
19
- # Step 2: Push to HF Space
20
- # This step copies ONLY your application code. The model will be
21
- # downloaded by the app itself when the Space starts.
22
  - name: Push to HF Space
23
  env:
24
  HF_USERNAME: ${{ secrets.HF_USERNAME }}
25
  HF_SPACE_NAME: ${{ secrets.HF_SPACE_NAME }}
26
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
27
  run: |
28
- git config --global user.email "github-actions[bot]@users.noreply.github.com"
29
- git config --global user.name "GitHub Action"
30
 
31
- echo "Cloning target HF Space..."
32
- git clone https://user:$HF_TOKEN@huggingface.co/spaces/${HF_USERNAME}/${HF_SPACE_NAME} hf_space_repo
33
-
34
- echo "Syncing application files..."
35
- # Note: We are NO LONGER copying the 'artifacts' folder
36
- rsync -av --delete --exclude='.git/' app/ app.py requirements.txt README.md setup.sh hf_space_repo/
37
-
38
- cd hf_space_repo
39
-
40
- echo "Committing and pushing to Space..."
41
- git add .
42
- git commit -m "Automatic deployment from GitHub Action" || echo "No changes to commit"
43
- git push
 
1
+ # .github/workflows/main.yml
2
+ # This workflow syncs the entire GitHub repository to a Hugging Face Space.
3
+ # It assumes large model files will be manually uploaded to the Space.
4
 
5
+ name: Sync to Hugging Face Space
6
 
7
  on:
8
  push:
 
10
  - main
11
 
12
  jobs:
13
+ sync-to-hub:
14
  runs-on: ubuntu-latest
15
 
16
  steps:
17
+ # Step 1: Check out your code from GitHub
18
  - name: Checkout repository
19
  uses: actions/checkout@v4
20
+ with:
21
+ fetch-depth: 0
22
 
23
+ # Step 2: Push the code to the Hugging Face Space remote
 
 
24
  - name: Push to HF Space
25
  env:
26
  HF_USERNAME: ${{ secrets.HF_USERNAME }}
27
  HF_SPACE_NAME: ${{ secrets.HF_SPACE_NAME }}
28
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
29
  run: |
30
+ # Add the Hugging Face Space as a remote named 'hf_space'
31
+ git remote add hf_space https://${HF_USERNAME}:${HF_TOKEN}@huggingface.co/spaces/${HF_USERNAME}/${HF_SPACE_NAME}
32
 
33
+ # Force push the local 'main' branch to the remote's 'main' branch
34
+ # This ensures the Space is an exact mirror of your GitHub repo
35
+ git push --force hf_space main