fahadcr14 commited on
Commit
60e0f3f
·
1 Parent(s): 10c89fa
Files changed (1) hide show
  1. .github/workflows/main.yml +14 -37
.github/workflows/main.yml CHANGED
@@ -1,46 +1,23 @@
1
- name: Deploy to Hugging Face Space
2
-
3
  on:
4
  push:
5
- branches:
6
- - main
 
 
7
 
8
  jobs:
9
- deploy:
10
  runs-on: ubuntu-latest
11
-
12
  steps:
13
- # Step 1: Checkout the repository
14
- - name: Checkout repository
15
- uses: actions/checkout@v3
16
-
17
- # Step 2: Set up Python environment
18
- - name: Set up Python
19
- uses: actions/setup-python@v4
20
  with:
21
- python-version: 3.11.6
22
-
23
- # Step 3: Install dependencies
24
- - name: Install dependencies
25
- run: |
26
- pip install --no-cache-dir -r requirements.txt
27
-
28
- # Step 4: Configure Git User
29
- - name: Configure Git User
30
- run: |
31
- git config --global user.name "Fahad Khan"
32
- git config --global user.email "[email protected]"
33
-
34
- # Step 5: Authenticate Hugging Face CLI
35
- - name: Authenticate Hugging Face CLI
36
  env:
37
- HF_TOKEN: ${{ secrets.HF_TOKEN }}
38
- run: huggingface-cli login --token $HF_TOKEN --add-to-git-credential
39
-
40
- # Step 6: Push application files to Hugging Face Space
41
- - name: Push Files to Hugging Face Space
42
  env:
43
- HF_TOKEN: ${{ secrets.HF_TOKEN }}
44
- run: |
45
- git pull --ff-only https://fahd9999:[email protected]/spaces/fahd9999/resultprediction main || true
46
- git push https://fahd9999:[email protected]/spaces/fahd9999/resultprediction main || true
 
1
+ name: Sync to Hugging Face hub
 
2
  on:
3
  push:
4
+ branches: [main]
5
+
6
+ # to run this workflow manually from the Actions tab
7
+ workflow_dispatch:
8
 
9
  jobs:
10
+ sync-to-hub:
11
  runs-on: ubuntu-latest
 
12
  steps:
13
+ - uses: actions/checkout@v2
 
 
 
 
 
 
14
  with:
15
+ fetch-depth: 0
16
+ - name: Add remote
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  env:
18
+ HF: ${{ secrets.HF_TOKEN }}
19
+ run: git remote add space https://fahd9999:[email protected]/spaces/resultprediction
20
+ - name: Push to hub
 
 
21
  env:
22
+ HF: ${{ secrets.HF_TOKEN }}
23
+ run: git push --force https://fahd9999:[email protected]/spaces/resultprediction main