WangDL 387785bd1e
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 19s
ci: deploy workflow 加 Apple 登录环境变量
2026-05-13 15:54:59 +08:00

55 lines
1.7 KiB
YAML

name: Deploy API Server
on:
push:
branches: [main]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout latest code
run: |
if [ -d /tmp/api-server ]; then
cd /tmp/api-server && git pull
else
git clone http://localhost:3000/suche-Hermes/api-server.git /tmp/api-server
fi
- name: Build Docker image
run: cd /tmp/api-server && docker build -t zhixi-api:latest .
- name: Stop old container
run: docker stop zhixi-api 2>/dev/null || true
- name: Remove old container
run: docker rm zhixi-api 2>/dev/null || true
- name: Start new container
run: |
docker run -d \
--name zhixi-api \
--network zhixi-net \
--restart unless-stopped \
-p 3001:3000 \
-e NODE_ENV=production \
-e PORT=3000 \
-e DATABASE_URL='mysql://zhixi_user:Zhixi@2026!App@mysql-zhixi:3306/zhixi' \
-e REDIS_HOST=redis-zhixi \
-e REDIS_PORT=6379 \
-e REDIS_PASSWORD='Rds@nTsgKrcqAkbuf6PwJIFMZQzF' \
-e JWT_SECRET=98b1e7e377a40021ad7c46c55e467d2a218a89db7afc7c912780152ad64bdc45 \
-e AI_PROVIDER=mock \
-e APPLE_BUNDLE_ID=cloud.longde.AIStudyApp \
-e APPLE_ISSUER=https://appleid.apple.com \
-e APPLE_JWKS_URL=https://appleid.apple.com/auth/keys \
-e ENABLE_SWAGGER=true \
-e SWAGGER_USER=admin \
-e SWAGGER_PASSWORD='Swgr@fmDentAYVXQUpG6oZDpJ' \
zhixi-api:latest
- name: Health check
run: |
sleep 8
curl -f http://localhost:3001/health || (docker logs zhixi-api --tail 30 && exit 1)