feat(smart-app): CI/CD pipeline + deploy scripts
Some checks failed
Some checks failed
- .gitea/workflows/build-and-deploy.yml: - Lint + TypeScript check on PR - Expo web build on push to master - Deploy via SSH to server (copy to /var/www/smartapp) - Docker build alternative - Artifact upload for builds - deploy.sh: manual deploy script (web|docker|api|all) - app.json: Expo config with bundle IDs - assets/: generated icons (icon, splash, adaptive, favicon) - Added expo-pwa, html-webpack-plugin, workbox-webpack-plugin deps
This commit is contained in:
81
smart-app-city/deploy.sh
Executable file
81
smart-app-city/deploy.sh
Executable file
@@ -0,0 +1,81 @@
|
||||
#!/bin/bash
|
||||
# Smart App City — Build & Deploy Script
|
||||
# Usage: ./deploy.sh [web|api|all]
|
||||
|
||||
set -e
|
||||
|
||||
FRONTEND_DIR="$(dirname "$0")/smart-app-city/frontend"
|
||||
DEPLOY_DIR="/var/www/smartapp"
|
||||
DOCKER_COMPOSE="$(dirname "$0")/smart-app-city/docker-compose.yml"
|
||||
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
||||
|
||||
echo "🏙️ Smart App City — Deploy (${TIMESTAMP})"
|
||||
echo "================================================"
|
||||
|
||||
build_web() {
|
||||
echo ""
|
||||
echo "📦 Building Expo web..."
|
||||
cd "${FRONTEND_DIR}"
|
||||
|
||||
echo " → Install deps..."
|
||||
npm ci --legacy-peer-deps --silent 2>/dev/null
|
||||
|
||||
echo " → Expo export:web..."
|
||||
npx expo export:web --output-dir dist 2>&1 | tail -5
|
||||
|
||||
echo " → Build OK → dist/"
|
||||
ls -lh dist/ | tail -5
|
||||
}
|
||||
|
||||
deploy_local() {
|
||||
echo ""
|
||||
echo "🚀 Deploying to local nginx..."
|
||||
|
||||
if [ ! -d "${DEPLOY_DIR}" ]; then
|
||||
sudo mkdir -p "${DEPLOY_DIR}"
|
||||
fi
|
||||
|
||||
sudo rm -rf "${DEPLOY_DIR:?}"/*
|
||||
sudo cp -r "${FRONTEND_DIR}/dist/"* "${DEPLOY_DIR}/"
|
||||
sudo chown -R www-data:www-data "${DEPLOY_DIR}"
|
||||
|
||||
echo " → Deployed to ${DEPLOY_DIR}/"
|
||||
echo " → URL: https://smartapp.digitribe.fr"
|
||||
}
|
||||
|
||||
deploy_docker() {
|
||||
echo ""
|
||||
echo "🐳 Deploying via Docker Compose..."
|
||||
cd "$(dirname "$DOCKER_COMPOSE")"
|
||||
docker compose up -d --build smartapp-web
|
||||
echo " → Container smartapp-web restarted"
|
||||
}
|
||||
|
||||
case "${1:-all}" in
|
||||
web)
|
||||
build_web
|
||||
deploy_local
|
||||
;;
|
||||
docker)
|
||||
build_web
|
||||
deploy_docker
|
||||
;;
|
||||
api)
|
||||
cd "$(dirname "$DOCKER_COMPOSE")"
|
||||
docker compose up -d --build api-gateway
|
||||
;;
|
||||
all)
|
||||
build_web
|
||||
deploy_local
|
||||
deploy_docker
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 [web|docker|api|all]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo ""
|
||||
echo "✅ Deploy complete!"
|
||||
echo "🌐 Web: https://smartapp.digitribe.fr"
|
||||
echo "🔌 API: https://api-smartapp.digitribe.fr"
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"expo": {
|
||||
"name": "Smart App City",
|
||||
"slug": "smart-app-city",
|
||||
"version": "0.1.0",
|
||||
"orientation": "portrait",
|
||||
"icon": "./assets/icon.png",
|
||||
"userInterfaceStyle": "automatic",
|
||||
"splash": {
|
||||
"image": "./assets/splash.png",
|
||||
"resizeMode": "contain",
|
||||
"backgroundColor": "#1565C0"
|
||||
},
|
||||
"assetBundlePatterns": ["**/*"],
|
||||
"ios": {
|
||||
"supportsTablet": true,
|
||||
"bundleIdentifier": "fr.digitribe.smartapp"
|
||||
},
|
||||
"android": {
|
||||
"adaptiveIcon": {
|
||||
"foregroundImage": "./assets/adaptive-icon.png",
|
||||
"backgroundColor": "#1565C0"
|
||||
},
|
||||
"package": "fr.digitribe.smartapp"
|
||||
},
|
||||
"web": {
|
||||
"favicon": "./assets/favicon.png",
|
||||
"bundler": "webpack"
|
||||
},
|
||||
"plugins": [
|
||||
"expo-localization",
|
||||
"expo-location",
|
||||
"expo-notifications"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
BIN
smart-app-city/frontend/assets/adaptive-icon.png
Normal file
BIN
smart-app-city/frontend/assets/adaptive-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
BIN
smart-app-city/frontend/assets/favicon.png
Normal file
BIN
smart-app-city/frontend/assets/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 355 B |
BIN
smart-app-city/frontend/assets/icon.png
Normal file
BIN
smart-app-city/frontend/assets/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
BIN
smart-app-city/frontend/assets/splash.png
Normal file
BIN
smart-app-city/frontend/assets/splash.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Reference in New Issue
Block a user