-
Notifications
You must be signed in to change notification settings - Fork 80
51 lines (43 loc) · 1.35 KB
/
push-to-hf.yml
File metadata and controls
51 lines (43 loc) · 1.35 KB
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
51
name: Push demo branch to Hugging Face
on:
workflow_call:
inputs:
ref:
required: false
default: demo
type: string
secrets:
HF_TOKEN:
required: true
jobs:
push-hf:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Git identity
run: |
git config --global user.email "actions@github.com"
git config --global user.name "github-actions[bot]"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install huggingface_hub
- name: Push to Hugging Face
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
HF_REPO_TYPE: spaces
HF_REPO_ID: chenzihong/GraphGen
run: |
git config --global credential.helper store
echo "https://user:${HF_TOKEN}@huggingface.co" > ~/.git-credentials
[[ -d hf-repo ]] && rm -rf hf-repo
git clone https://huggingface.co/${HF_REPO_TYPE}/${HF_REPO_ID} hf-repo
rsync -a --delete --exclude='.git' --exclude='hf-repo' --exclude='README.md' ./ hf-repo/
cd hf-repo
git add .
git diff-index --quiet HEAD || \
(git commit -m "Auto-sync from ${{ inputs.ref }} at $(date -u)" && git push)