Update and rename deploy.yml to sync_to_hf.yml
Browse files- .github/workflows/deploy.yml +0 -30
- .github/workflows/sync_to_hf.yml +36 -0
.github/workflows/deploy.yml
DELETED
|
@@ -1,30 +0,0 @@
|
|
| 1 |
-
name: Build and Push to Hugging Face Space
|
| 2 |
-
|
| 3 |
-
on:
|
| 4 |
-
push:
|
| 5 |
-
branches:
|
| 6 |
-
- main
|
| 7 |
-
|
| 8 |
-
jobs:
|
| 9 |
-
deploy:
|
| 10 |
-
runs-on: ubuntu-latest
|
| 11 |
-
steps:
|
| 12 |
-
- name: Checkout code
|
| 13 |
-
uses: actions/checkout@v3
|
| 14 |
-
with:
|
| 15 |
-
lfs: true
|
| 16 |
-
|
| 17 |
-
- name: Set up Docker Buildx
|
| 18 |
-
uses: docker/setup-buildx-action@v2
|
| 19 |
-
|
| 20 |
-
- name: Login to Hugging Face Registry
|
| 21 |
-
env:
|
| 22 |
-
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 23 |
-
# نکته کلیدی: اینجا برای ورود نام دقیق کاربری (Opera8) را وارد میکنیم
|
| 24 |
-
run: echo $HF_TOKEN | docker login registry.hf.space -u Opera8 --password-stdin
|
| 25 |
-
|
| 26 |
-
- name: Build and Push
|
| 27 |
-
run: |
|
| 28 |
-
# نکته کلیدی: اما اینجا برای آدرس داکر حتما باید حروف کوچک (opera8) باشد
|
| 29 |
-
docker build -t registry.hf.space/opera8/bot:latest .
|
| 30 |
-
docker push registry.hf.space/opera8/bot:latest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.github/workflows/sync_to_hf.yml
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Sync to Hugging Face Hub
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches: [main] # یا master اگر برنچ اصلی شما master است
|
| 6 |
+
|
| 7 |
+
# برای اجرای دستی اکشن از تب Actions
|
| 8 |
+
workflow_dispatch:
|
| 9 |
+
|
| 10 |
+
jobs:
|
| 11 |
+
sync-to-hub:
|
| 12 |
+
runs-on: ubuntu-latest
|
| 13 |
+
steps:
|
| 14 |
+
- name: Checkout local repository
|
| 15 |
+
uses: actions/checkout@v3
|
| 16 |
+
with:
|
| 17 |
+
fetch-depth: 0
|
| 18 |
+
lfs: true
|
| 19 |
+
|
| 20 |
+
- name: Push to Hugging Face Space
|
| 21 |
+
env:
|
| 22 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 23 |
+
run: |
|
| 24 |
+
# تنظیمات گیت
|
| 25 |
+
git config --global user.email "action@github.com"
|
| 26 |
+
git config --global user.name "GitHub Action"
|
| 27 |
+
|
| 28 |
+
# اضافه کردن ریموت هاگینگ فیس
|
| 29 |
+
# فرمت: https://USERNAME:TOKEN@huggingface.co/spaces/USERNAME/SPACE_NAME
|
| 30 |
+
# فرض بر این است که نام کاربری opera8 و نام اسپیس chat است
|
| 31 |
+
# اگر نام اسپیس شما چیز دیگری است، قسمت آخر آدرس زیر را تغییر دهید
|
| 32 |
+
|
| 33 |
+
git remote add space https://opera8:$HF_TOKEN@huggingface.co/spaces/opera8/chat
|
| 34 |
+
|
| 35 |
+
# فورس پوش کردن به اسپیس
|
| 36 |
+
git push --force space main
|