MuhZainur commited on
Commit
e513ee8
·
unverified ·
1 Parent(s): c4fa612

Create deploy_to_hf_space.yml

Browse files
.github/workflows/deploy_to_hf_space.yml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Deploy to Hugging Face Space
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ deploy-to-space:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ # Langkah 1: Ambil kode dari repository GitHub
13
+ - name: Checkout repository
14
+ uses: actions/checkout@v3
15
+ with:
16
+ fetch-depth: 0
17
+
18
+ # Langkah 2: Lakukan push manual ke Hugging Face Space
19
+ - name: Push to Hugging Face Space
20
+ env:
21
+ # Ambil token dari GitHub Secrets
22
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
23
+ run: |
24
+ # Konfigurasi git dengan user dummy
25
+ git config --global user.email "github-actions@github.com"
26
+ git config --global user.name "GitHub Actions"
27
+
28
+ # Tambahkan remote repository untuk Hugging Face Space, sertakan token untuk otentikasi
29
+ # Ganti repo_id jika berbeda
30
+ git remote add space https://oauth:${HF_TOKEN}@huggingface.co/spaces/Zainajabroh/sentiment_analysis
31
+
32
+ # Lakukan force push dari branch 'main' di GitHub ke branch 'main' di Hugging Face Space
33
+ git push --force space main