Spaces:
Running
Running
luanpoppe
commited on
Commit
·
8836d9d
1
Parent(s):
e9a035c
fix: new possible fix
Browse files
.github/workflows/sync-to-huggingface.yml
CHANGED
@@ -3,8 +3,8 @@ name: Sync to Hugging Face Spaces with SSH
|
|
3 |
on:
|
4 |
push:
|
5 |
branches:
|
6 |
-
- main
|
7 |
-
- tests
|
8 |
|
9 |
jobs:
|
10 |
sync-to-hub:
|
@@ -15,41 +15,43 @@ jobs:
|
|
15 |
fetch-depth: 0
|
16 |
lfs: true
|
17 |
|
|
|
|
|
|
|
|
|
|
|
18 |
- name: Set up SSH
|
19 |
run: |
|
20 |
-
# Create .ssh directory and
|
21 |
mkdir -p ~/.ssh
|
22 |
echo "${{ secrets.HF_SSH_PRIVATE_KEY }}" > ~/.ssh/custom_key
|
23 |
chmod 600 ~/.ssh/custom_key
|
24 |
-
ssh-keyscan huggingface.co >> ~/.ssh/known_hosts
|
25 |
|
26 |
-
#
|
27 |
-
echo "
|
28 |
-
|
|
|
29 |
|
30 |
-
# Add
|
31 |
-
|
32 |
-
git remote set-url space [email protected]:spaces/luanpoppe/vella-backend.git || true
|
33 |
|
|
|
|
|
|
|
34 |
git remote add tests [email protected]:spaces/luanpoppe/vella-backend-tests.git || true
|
35 |
-
git remote set-url tests [email protected]:spaces/luanpoppe/vella-backend-tests.git || true
|
36 |
|
37 |
-
# Debug
|
38 |
-
echo "Remotes after update:"
|
39 |
git remote -v
|
40 |
|
41 |
-
- name:
|
42 |
-
id: determine_remote
|
43 |
run: |
|
44 |
if [[ $GITHUB_REF == "refs/heads/main" ]]; then
|
45 |
-
|
46 |
elif [[ $GITHUB_REF == "refs/heads/tests" ]]; then
|
47 |
-
|
48 |
else
|
49 |
echo "Branch not configured for sync"
|
50 |
exit 1
|
51 |
fi
|
52 |
|
53 |
-
- name: Push to Hugging Face Space
|
54 |
-
run: |
|
55 |
GIT_SSH_COMMAND="ssh -i ~/.ssh/custom_key" git push $TARGET_REMOTE HEAD:main --force
|
|
|
3 |
on:
|
4 |
push:
|
5 |
branches:
|
6 |
+
- main
|
7 |
+
- tests
|
8 |
|
9 |
jobs:
|
10 |
sync-to-hub:
|
|
|
15 |
fetch-depth: 0
|
16 |
lfs: true
|
17 |
|
18 |
+
- name: Install SSH dependencies
|
19 |
+
run: |
|
20 |
+
sudo apt-get update
|
21 |
+
sudo apt-get install -y openssh-client # Fix: Ensure ssh-keyscan is available
|
22 |
+
|
23 |
- name: Set up SSH
|
24 |
run: |
|
25 |
+
# Create .ssh directory and key
|
26 |
mkdir -p ~/.ssh
|
27 |
echo "${{ secrets.HF_SSH_PRIVATE_KEY }}" > ~/.ssh/custom_key
|
28 |
chmod 600 ~/.ssh/custom_key
|
|
|
29 |
|
30 |
+
# Verify key file exists
|
31 |
+
echo "Key file contents (first 50 chars):"
|
32 |
+
head -c 50 ~/.ssh/custom_key || true
|
33 |
+
echo ""
|
34 |
|
35 |
+
# Add Hugging Face to known_hosts
|
36 |
+
ssh-keyscan huggingface.co >> ~/.ssh/known_hosts
|
|
|
37 |
|
38 |
+
# Configure Git remotes
|
39 |
+
git config --global url."[email protected]:".insteadOf "https://huggingface.co/" # Force SSH for all Hugging Face URLs
|
40 |
+
git remote add space [email protected]:spaces/luanpoppe/vella-backend.git || true
|
41 |
git remote add tests [email protected]:spaces/luanpoppe/vella-backend-tests.git || true
|
|
|
42 |
|
43 |
+
# Debug remotes
|
|
|
44 |
git remote -v
|
45 |
|
46 |
+
- name: Push to Hugging Face Space
|
|
|
47 |
run: |
|
48 |
if [[ $GITHUB_REF == "refs/heads/main" ]]; then
|
49 |
+
TARGET_REMOTE="space"
|
50 |
elif [[ $GITHUB_REF == "refs/heads/tests" ]]; then
|
51 |
+
TARGET_REMOTE="tests"
|
52 |
else
|
53 |
echo "Branch not configured for sync"
|
54 |
exit 1
|
55 |
fi
|
56 |
|
|
|
|
|
57 |
GIT_SSH_COMMAND="ssh -i ~/.ssh/custom_key" git push $TARGET_REMOTE HEAD:main --force
|