Spaces:
Running
Running
Update upload.sh
Browse files
upload.sh
CHANGED
@@ -1,32 +1,22 @@
|
|
1 |
#!/bin/bash
|
2 |
-
|
3 |
-
# Exit on error
|
4 |
set -e
|
5 |
|
6 |
-
# Check if the token is set
|
7 |
if [ -z "$sc4sc_token" ]; then
|
8 |
echo "Error: Environment variable sc4sc_token is not set."
|
9 |
exit 1
|
10 |
fi
|
11 |
|
12 |
-
# Define variables
|
13 |
SPACE_REPO="sc4sc/editor"
|
14 |
-
|
15 |
-
TEMP_DIR=$(mktemp -d)
|
16 |
-
ZIP_FILE="$TEMP_DIR/upload.zip"
|
17 |
-
|
18 |
-
# Create zip of all files and folders in current directory
|
19 |
-
zip -r "$ZIP_FILE" . -x "*.git*" -x "$ZIP_FILE"
|
20 |
|
21 |
-
#
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
-H "Content-Type: application/zip" \
|
27 |
-
--data-binary @"$ZIP_FILE"
|
28 |
|
29 |
-
|
30 |
-
|
|
|
31 |
|
32 |
-
echo "✅
|
|
|
1 |
#!/bin/bash
|
|
|
|
|
2 |
set -e
|
3 |
|
|
|
4 |
if [ -z "$sc4sc_token" ]; then
|
5 |
echo "Error: Environment variable sc4sc_token is not set."
|
6 |
exit 1
|
7 |
fi
|
8 |
|
|
|
9 |
SPACE_REPO="sc4sc/editor"
|
10 |
+
GIT_URL="https://hf_$sc4sc_token@huggingface.co/spaces/$SPACE_REPO"
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
+
# Initialize repo if not already
|
13 |
+
if [ ! -d ".git" ]; then
|
14 |
+
git init
|
15 |
+
git remote add origin "$GIT_URL"
|
16 |
+
fi
|
|
|
|
|
17 |
|
18 |
+
git add .
|
19 |
+
git commit -m "Automated update" || echo "Nothing to commit"
|
20 |
+
git push origin main
|
21 |
|
22 |
+
echo "✅ Space successfully updated."
|