generated from pnstack/template-python
-
-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (43 loc) · 1.36 KB
/
deploy-to-huggingface.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
42
43
44
45
46
47
48
49
50
name: Deploy to Hugging Face
on:
push:
branches:
- main
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: Config git
run: |
git config --global credential.helper store
git config --global user.email "[email protected]"
git config --global user.name "github-actions"
- name: Configure Hugging Face
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
HF_USERNAME: ${{ secrets.HF_USERNAME }}
run: |
# Install Hugging Face CLI
pip install huggingface-hub
# Login to Hugging Face
huggingface-cli login --token $HF_TOKEN --add-to-git-credential
- name: Push to Hugging Face
env:
HF_USERNAME: ${{ secrets.HF_USERNAME }}
SPACE_NAME: ${{ secrets.SPACE_NAME }}
run: |
# Create repository URL
REPO_URL="https://huggingface.co/spaces/$HF_USERNAME/capture-page-tools"
# Add Hugging Face as a remote and push
git remote add space $REPO_URL || git remote set-url space $REPO_URL
git push -f space main