Spaces:
Running
Running
AILIXIR Bot commited on
Commit ·
3f68d0d
1
Parent(s): 30eccba
Auto-sync: cd8c6a6717fcdbcef9e4616570708f611f701dd7
Browse files- .github/workflows/sync-hf-all.yml +6 -11
- docker/entrypoint.sh +11 -0
.github/workflows/sync-hf-all.yml
CHANGED
|
@@ -36,12 +36,17 @@ jobs:
|
|
| 36 |
- name: Install Hugging Face CLI
|
| 37 |
run: pip install -U "huggingface_hub[cli]"
|
| 38 |
|
| 39 |
-
- name: Set
|
| 40 |
env:
|
| 41 |
HF_TOKEN: ${{ secrets.HF_TOKEN_AILIXIR }}
|
|
|
|
|
|
|
| 42 |
run: |
|
| 43 |
hf spaces secrets add Ailixir-AI-Team/ailixir-api \
|
| 44 |
-s RUN_MODE=hf \
|
|
|
|
|
|
|
|
|
|
| 45 |
--token "$HF_TOKEN" 2>/dev/null || true
|
| 46 |
|
| 47 |
- name: Sync ailixir-api
|
|
@@ -55,16 +60,6 @@ jobs:
|
|
| 55 |
# Sync files (new, modified, deleted) but preserve the live database
|
| 56 |
rsync -av --delete --exclude=ai_apps --exclude=.git --exclude=.env --exclude=.dockerignore --exclude=public/imgs --exclude=storage --exclude=Diagrams --exclude=database/ailixir.sqlite "$GITHUB_WORKSPACE/" .
|
| 57 |
cp "$GITHUB_WORKSPACE/README_HF.md" README.md 2>/dev/null || true
|
| 58 |
-
# Write .env from .env.hf (single source of truth for all AI service URLs)
|
| 59 |
-
cp "$GITHUB_WORKSPACE/.env.hf" .env
|
| 60 |
-
printf '%s\n' \
|
| 61 |
-
'APP_KEY=base64:T/MgQZht16genNJN3aZ5flCuvfe7Zfs4yFhuAFO2itU=' \
|
| 62 |
-
'APP_DEBUG=true' \
|
| 63 |
-
'GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }}' \
|
| 64 |
-
'GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }}' \
|
| 65 |
-
'GOOGLE_REDIRECT_URI=https://Ailixir-AI-Team-ailixir-api.hf.space/api/user/auth/google' \
|
| 66 |
-
'QUEUE_CONNECTION=sync' \
|
| 67 |
-
>> .env
|
| 68 |
git config user.name "AILIXIR Bot"
|
| 69 |
git config user.email "bot@ailixir.app"
|
| 70 |
# Prevent the live database from being tracked/committed
|
|
|
|
| 36 |
- name: Install Hugging Face CLI
|
| 37 |
run: pip install -U "huggingface_hub[cli]"
|
| 38 |
|
| 39 |
+
- name: Set HF Space secrets
|
| 40 |
env:
|
| 41 |
HF_TOKEN: ${{ secrets.HF_TOKEN_AILIXIR }}
|
| 42 |
+
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
|
| 43 |
+
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
|
| 44 |
run: |
|
| 45 |
hf spaces secrets add Ailixir-AI-Team/ailixir-api \
|
| 46 |
-s RUN_MODE=hf \
|
| 47 |
+
-s APP_KEY=base64:T/MgQZht16genNJN3aZ5flCuvfe7Zfs4yFhuAFO2itU= \
|
| 48 |
+
-s GOOGLE_CLIENT_ID="$GOOGLE_CLIENT_ID" \
|
| 49 |
+
-s GOOGLE_CLIENT_SECRET="$GOOGLE_CLIENT_SECRET" \
|
| 50 |
--token "$HF_TOKEN" 2>/dev/null || true
|
| 51 |
|
| 52 |
- name: Sync ailixir-api
|
|
|
|
| 60 |
# Sync files (new, modified, deleted) but preserve the live database
|
| 61 |
rsync -av --delete --exclude=ai_apps --exclude=.git --exclude=.env --exclude=.dockerignore --exclude=public/imgs --exclude=storage --exclude=Diagrams --exclude=database/ailixir.sqlite "$GITHUB_WORKSPACE/" .
|
| 62 |
cp "$GITHUB_WORKSPACE/README_HF.md" README.md 2>/dev/null || true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
git config user.name "AILIXIR Bot"
|
| 64 |
git config user.email "bot@ailixir.app"
|
| 65 |
# Prevent the live database from being tracked/committed
|
docker/entrypoint.sh
CHANGED
|
@@ -3,6 +3,17 @@ set -e
|
|
| 3 |
|
| 4 |
cd /var/www/html
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
php artisan config:clear --no-interaction 2>/dev/null || true
|
| 8 |
|
|
|
|
| 3 |
|
| 4 |
cd /var/www/html
|
| 5 |
|
| 6 |
+
# Generate .env from .env.hf on HF Spaces
|
| 7 |
+
if [ "${RUN_MODE}" = "hf" ] && [ -f /var/www/html/.env.hf ]; then
|
| 8 |
+
cp /var/www/html/.env.hf /var/www/html/.env
|
| 9 |
+
echo "QUEUE_CONNECTION=sync" >> /var/www/html/.env
|
| 10 |
+
echo "APP_DEBUG=true" >> /var/www/html/.env
|
| 11 |
+
[ -n "${APP_KEY}" ] && echo "APP_KEY=${APP_KEY}" >> /var/www/html/.env
|
| 12 |
+
[ -n "${GOOGLE_CLIENT_ID}" ] && echo "GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}" >> /var/www/html/.env
|
| 13 |
+
[ -n "${GOOGLE_CLIENT_SECRET}" ] && echo "GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET}" >> /var/www/html/.env
|
| 14 |
+
[ -n "${APP_URL}" ] && echo "GOOGLE_REDIRECT_URI=${APP_URL}/api/user/auth/google" >> /var/www/html/.env
|
| 15 |
+
echo ".env generated from .env.hf"
|
| 16 |
+
fi
|
| 17 |
|
| 18 |
php artisan config:clear --no-interaction 2>/dev/null || true
|
| 19 |
|