feat: Phase 1 mobile tablet — Jenkins APK, PC tab, in-app update
Capacitor 확장으로 git push 시 Mobile Jenkins 빌드, PC 탭 Android/iPad 다운로드, 앱 내 APK 업데이트, iOS TestFlight API 및 Capacitor ios 프로젝트를 추가한다. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
# Jenkins goldenChart-Mobile-Pipeline — Android APK 빌드·배포
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
WORK_TREE="${WORK_TREE:-/Users/aidev/apps/goldenChart}"
|
||||
export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:${PATH:-/usr/bin:/bin}"
|
||||
for prefix in "$HOME/homebrew" /opt/homebrew; do
|
||||
[[ -x "$prefix/bin/brew" ]] && eval "$("$prefix/bin/brew" shellenv)"
|
||||
done
|
||||
|
||||
log() { echo "[mobile-pipeline $(date '+%H:%M:%S')] $*"; }
|
||||
|
||||
log "=== goldenChart Mobile Pipeline #${BUILD_NUMBER:-local} ==="
|
||||
log "WORK_TREE=$WORK_TREE"
|
||||
|
||||
cd "$WORK_TREE"
|
||||
|
||||
if [[ -d "${GIT_DIR:-/Volumes/ADATA/git/goldenChart.git}" ]]; then
|
||||
git --git-dir="${GIT_DIR:-/Volumes/ADATA/git/goldenChart.git}" \
|
||||
--work-tree="$WORK_TREE" checkout -f main 2>/dev/null || true
|
||||
fi
|
||||
|
||||
chmod +x "$ROOT/scripts/"*.sh 2>/dev/null || true
|
||||
|
||||
"$ROOT/scripts/build-mobile-apk.sh"
|
||||
|
||||
VERSION_NAME="$(grep -E 'versionName\s+"' "$ROOT/app/android/app/build.gradle" | head -1 | sed -E 's/.*versionName\s+"([^"]+)".*/\1/' || true)"
|
||||
|
||||
if [[ -n "$VERSION_NAME" ]]; then
|
||||
log "APK version → $VERSION_NAME"
|
||||
ENV_FILE="$WORK_TREE/.env"
|
||||
if [[ -f "$ENV_FILE" ]]; then
|
||||
{ grep -v '^GC_MOBILE_APP_VERSION=' "$ENV_FILE" || true; echo "GC_MOBILE_APP_VERSION=${VERSION_NAME}"; } > "${ENV_FILE}.tmp"
|
||||
mv "${ENV_FILE}.tmp" "$ENV_FILE"
|
||||
else
|
||||
echo "GC_MOBILE_APP_VERSION=${VERSION_NAME}" >> "$ENV_FILE"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -x "$WORK_TREE/scripts/restart-backend-if-running.sh" ]]; then
|
||||
WORK_TREE="$WORK_TREE" "$WORK_TREE/scripts/restart-backend-if-running.sh" || true
|
||||
elif docker compose -f "$WORK_TREE/docker-compose.yml" ps -q backend 2>/dev/null | grep -q .; then
|
||||
log "backend 재시작 (APK 볼륨 반영)"
|
||||
(cd "$WORK_TREE" && docker compose up -d --no-deps backend) || true
|
||||
fi
|
||||
|
||||
log "Artifacts: $WORK_TREE/data/mobile-releases/"
|
||||
log "Pipeline complete."
|
||||
Reference in New Issue
Block a user