Spaces:
Running
Running
luanpoppe
commited on
Commit
·
7f500ed
1
Parent(s):
8c37731
fix: github actions com ssh
Browse files
.github/workflows/sync-to-huggingface.yml
CHANGED
@@ -1,13 +1,10 @@
|
|
1 |
-
name: Sync to Hugging Face Spaces
|
2 |
|
3 |
on:
|
4 |
push:
|
5 |
branches:
|
6 |
- main # Push to the first Space when main is updated
|
7 |
-
- tests
|
8 |
-
|
9 |
-
# Allow manual triggering of the workflow
|
10 |
-
workflow_dispatch:
|
11 |
|
12 |
jobs:
|
13 |
sync-to-hub:
|
@@ -18,20 +15,25 @@ jobs:
|
|
18 |
fetch-depth: 0
|
19 |
lfs: true
|
20 |
|
21 |
-
- name:
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
run: |
|
24 |
if [[ $GITHUB_REF == "refs/heads/main" ]]; then
|
25 |
-
echo "
|
26 |
-
elif [[ $GITHUB_REF == "refs/heads/
|
27 |
-
echo "
|
28 |
else
|
29 |
echo "Branch not configured for sync"
|
30 |
exit 1
|
31 |
fi
|
32 |
|
33 |
- name: Push to Hugging Face Space
|
34 |
-
env:
|
35 |
-
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
36 |
run: |
|
37 |
-
git push $
|
|
|
1 |
+
name: Sync to Hugging Face Spaces with SSH
|
2 |
|
3 |
on:
|
4 |
push:
|
5 |
branches:
|
6 |
- main # Push to the first Space when main is updated
|
7 |
+
- tests # Push to the second Space when tests is updated
|
|
|
|
|
|
|
8 |
|
9 |
jobs:
|
10 |
sync-to-hub:
|
|
|
15 |
fetch-depth: 0
|
16 |
lfs: true
|
17 |
|
18 |
+
- name: Set up SSH
|
19 |
+
run: |
|
20 |
+
mkdir -p ~/.ssh
|
21 |
+
echo "${{ secrets.HF_SSH_PRIVATE_KEY }}" > ~/.ssh/custom_key
|
22 |
+
chmod 600 ~/.ssh/custom_key
|
23 |
+
ssh-keyscan huggingface.co >> ~/.ssh/known_hosts
|
24 |
+
|
25 |
+
- name: Determine target remote
|
26 |
+
id: determine_remote
|
27 |
run: |
|
28 |
if [[ $GITHUB_REF == "refs/heads/main" ]]; then
|
29 |
+
echo "TARGET_REMOTE=space" >> $GITHUB_ENV
|
30 |
+
elif [[ $GITHUB_REF == "refs/heads/tests" ]]; then
|
31 |
+
echo "TARGET_REMOTE=tests" >> $GITHUB_ENV
|
32 |
else
|
33 |
echo "Branch not configured for sync"
|
34 |
exit 1
|
35 |
fi
|
36 |
|
37 |
- name: Push to Hugging Face Space
|
|
|
|
|
38 |
run: |
|
39 |
+
GIT_SSH_COMMAND="ssh -i ~/.ssh/custom_key" git push $TARGET_REMOTE $GITHUB_REF:main --force
|