Spaces:
Running
Running
hf config
Browse files
.github/workflows/sync-to-hub.yml
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
# .github/workflows/sync-to-hf.yml
|
2 |
name: Sync to Hugging Face hub
|
3 |
on:
|
4 |
push:
|
@@ -9,52 +8,47 @@ jobs:
|
|
9 |
sync-to-hub:
|
10 |
runs-on: ubuntu-latest
|
11 |
steps:
|
12 |
-
- uses: actions/checkout@
|
13 |
with:
|
14 |
fetch-depth: 0
|
15 |
lfs: true
|
16 |
|
17 |
-
- name:
|
18 |
-
run: git lfs install --local
|
19 |
-
|
20 |
-
- name: Configure git identity
|
21 |
run: |
|
22 |
-
git config user.email "[email protected]"
|
23 |
git config user.name "GitHub Actions"
|
|
|
|
|
24 |
|
25 |
-
# --- Set your real HF username & space slug here ---
|
26 |
- name: Set vars
|
27 |
run: |
|
28 |
echo "HF_USERNAME=SCGR" >> $GITHUB_ENV
|
29 |
echo "SPACE_NAME=Promptaid_Vision" >> $GITHUB_ENV
|
30 |
|
31 |
-
# --- Sanity checks so we fail with helpful messages ---
|
32 |
- name: Check token & space reachability
|
33 |
env:
|
34 |
-
|
35 |
run: |
|
36 |
set -euo pipefail
|
37 |
-
test -n "$
|
38 |
-
echo "
|
39 |
-
curl -sS -H "Authorization: Bearer $
|
40 |
-
echo
|
41 |
-
|
42 |
-
|
|
|
43 |
|
44 |
-
- name: Test auth to HF Space
|
45 |
env:
|
46 |
-
|
47 |
run: |
|
48 |
set -euo pipefail
|
49 |
-
git ls-remote https://${HF_USERNAME}:${
|
50 |
|
51 |
- name: Push to HF Space
|
52 |
env:
|
53 |
-
|
54 |
run: |
|
55 |
set -euo pipefail
|
56 |
-
# clean remote if re-running
|
57 |
git remote remove space 2>/dev/null || true
|
58 |
-
git remote add space https://${HF_USERNAME}:${
|
59 |
-
echo "Pushing HEAD to space main…"
|
60 |
git push space HEAD:main --force --verbose
|
|
|
|
|
1 |
name: Sync to Hugging Face hub
|
2 |
on:
|
3 |
push:
|
|
|
8 |
sync-to-hub:
|
9 |
runs-on: ubuntu-latest
|
10 |
steps:
|
11 |
+
- uses: actions/checkout@v4
|
12 |
with:
|
13 |
fetch-depth: 0
|
14 |
lfs: true
|
15 |
|
16 |
+
- name: Configure git
|
|
|
|
|
|
|
17 |
run: |
|
|
|
18 |
git config user.name "GitHub Actions"
|
19 |
+
git config user.email "[email protected]"
|
20 |
+
git lfs install --local
|
21 |
|
|
|
22 |
- name: Set vars
|
23 |
run: |
|
24 |
echo "HF_USERNAME=SCGR" >> $GITHUB_ENV
|
25 |
echo "SPACE_NAME=Promptaid_Vision" >> $GITHUB_ENV
|
26 |
|
|
|
27 |
- name: Check token & space reachability
|
28 |
env:
|
29 |
+
HF_API_KEY: ${{ secrets.HF_API_KEY }}
|
30 |
run: |
|
31 |
set -euo pipefail
|
32 |
+
test -n "$HF_API_KEY" || (echo "Missing GitHub secret HF_API_KEY" && exit 1)
|
33 |
+
echo "WHOAMI:"
|
34 |
+
curl -sS -H "Authorization: Bearer $HF_API_KEY" https://huggingface.co/api/whoami-v2 || exit 1
|
35 |
+
echo; echo "Check space URL:"
|
36 |
+
curl -sS -o /dev/null -w "HTTP %{http_code}\n" \
|
37 |
+
-H "Authorization: Bearer $HF_API_KEY" \
|
38 |
+
https://huggingface.co/spaces/${HF_USERNAME}/${SPACE_NAME}
|
39 |
|
40 |
+
- name: Test git auth to HF Space
|
41 |
env:
|
42 |
+
HF_API_KEY: ${{ secrets.HF_API_KEY }}
|
43 |
run: |
|
44 |
set -euo pipefail
|
45 |
+
git ls-remote https://${HF_USERNAME}:${HF_API_KEY}@huggingface.co/spaces/${HF_USERNAME}/${SPACE_NAME}.git
|
46 |
|
47 |
- name: Push to HF Space
|
48 |
env:
|
49 |
+
HF_API_KEY: ${{ secrets.HF_API_KEY }}
|
50 |
run: |
|
51 |
set -euo pipefail
|
|
|
52 |
git remote remove space 2>/dev/null || true
|
53 |
+
git remote add space https://${HF_USERNAME}:${HF_API_KEY}@huggingface.co/spaces/${HF_USERNAME}/${SPACE_NAME}.git
|
|
|
54 |
git push space HEAD:main --force --verbose
|