Update hf-deploy.yml
Browse files- .github/workflows/hf-deploy.yml +41 -34
.github/workflows/hf-deploy.yml
CHANGED
@@ -6,39 +6,46 @@ on:
|
|
6 |
- main
|
7 |
|
8 |
jobs:
|
9 |
-
deploy
|
10 |
runs-on: ubuntu-latest
|
|
|
11 |
steps:
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
- main
|
7 |
|
8 |
jobs:
|
9 |
+
deploy:
|
10 |
runs-on: ubuntu-latest
|
11 |
+
|
12 |
steps:
|
13 |
+
- name: Checkout code
|
14 |
+
uses: actions/checkout@v3
|
15 |
+
with:
|
16 |
+
fetch-depth: 0
|
17 |
+
|
18 |
+
- name: Set up Python
|
19 |
+
uses: actions/setup-python@v3
|
20 |
+
with:
|
21 |
+
python-version: 3.9
|
22 |
+
|
23 |
+
- name: Install Hugging Face CLI
|
24 |
+
run: |
|
25 |
+
pip install huggingface_hub
|
26 |
+
mkdir -p ~/.huggingface
|
27 |
+
echo ${{ secrets.HF_TOKEN }} > ~/.huggingface/token
|
28 |
+
huggingface-cli login --token ${{ secrets.HF_TOKEN }}
|
29 |
+
|
30 |
+
- name: Configure Git for Hugging Face
|
31 |
+
run: |
|
32 |
+
git config --global user.name "nkofficial-1005"
|
33 |
+
git config --global user.email "nikita.datascience@gmail.com"
|
34 |
+
# Set the remote to your Hugging Face Space repo (update the repo name if needed)
|
35 |
+
git remote add hf https://huggingface.co/spaces/kohlin/nlp-spacy || true
|
36 |
+
git remote set-url hf https://kohlin:${{ secrets.HF_TOKEN }}@huggingface.co/spaces/kohlin/nlp-spacy
|
37 |
+
|
38 |
+
- name: Set up Git LFS (if needed)
|
39 |
+
run: |
|
40 |
+
git lfs install
|
41 |
+
git lfs pull hf main || true
|
42 |
+
|
43 |
+
- name: Pull latest changes from Hugging Face (merge histories)
|
44 |
+
run: |
|
45 |
+
git pull hf main --allow-unrelated-histories --no-rebase || true
|
46 |
+
|
47 |
+
- name: Push latest code to Hugging Face
|
48 |
+
run: |
|
49 |
+
git push hf main --force-with-lease
|
50 |
+
env:
|
51 |
+
HUGGINGFACE_TOKEN: ${{ secrets.HF_TOKEN }}
|