-
Notifications
You must be signed in to change notification settings - Fork 6
41 lines (34 loc) · 1 KB
/
deploy-hf.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Deploy Docker Image to Hugging Face Spaces
on:
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install Python dependencies
run: pip install --upgrade huggingface_hub
- name: Create Dockerfile
run: |
echo 'FROM drfyup/rss2tg:latest' > Dockerfile
- name: Upload Dockerfile to Hugging Face Spaces
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
SPACE_ID: drfy/rss2tg # 替换为你的Space ID,例如 `username/my-space`
run: |
python -c "
from huggingface_hub import HfApi
api = HfApi()
api.upload_file(
path_or_fileobj='Dockerfile',
path_in_repo='Dockerfile',
repo_id='${{ env.SPACE_ID }}',
repo_type='space',
token='${{ secrets.HF_TOKEN }}'
)
"