From 298f73b02b1162ee0752649ece6f22856f527aa9 Mon Sep 17 00:00:00 2001 From: JulianAlcala Date: Tue, 12 May 2026 07:32:52 -0500 Subject: [PATCH] ci(codemagic): add staging + production workflows for legacy store builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Codemagic se usa como herramienta de release (Play Store + App Store), no como CI general. La validación de develop / feature branches sigue siendo local. Workflows: - staging_android / staging_ios — push a fusion-app → Play Internal Track + TestFlight - production_android / production_ios — tag 1.0.0(N) → Play (draft) + App Store (manual review) Todos los workflows publicables buildean en APP_MODE=legacy mientras el roadmap premium de Treezor no esté listo para producción. Scripts en codemagic_scripts/: - project_setup.sh — melos bootstrap (build_runner no es necesario, los .freezed.dart y .g.dart están commiteados) - analyze_and_test.sh — melos run analyze + test con --no-select obligatorio (sin TTY melos crashea con StdinException) - android_dependencies.sh — verifica gradle wrapper - android_key_properties.sh — escribe key.properties desde CM_KEYSTORE_* - ios_signing_cocoapods.sh — gem install cocoapods + xcode-project use-profiles - flutter_build.sh — build aab/ipa con --dart-define=APP_MODE; parser para tags formato 1.0.0(N) o v1.0.0(N) en producción - print_versions.sh — log de versiones y herramientas - build_status.sh — exit + notificación Google Chat ante fallo Setup detallado y bloqueantes externos en docs/codemagic-integration.md. --- codemagic.yaml | 167 +++++++ codemagic_scripts/analyze_and_test.sh | 5 + codemagic_scripts/android_dependencies.sh | 5 + codemagic_scripts/android_key_properties.sh | 9 + codemagic_scripts/build_status.sh | 22 + codemagic_scripts/flutter_build.sh | 52 +++ codemagic_scripts/ios_signing_cocoapods.sh | 5 + codemagic_scripts/print_versions.sh | 33 ++ codemagic_scripts/project_setup.sh | 5 + docs/codemagic-integration.md | 469 ++++++++++++++++++++ 10 files changed, 772 insertions(+) create mode 100644 codemagic.yaml create mode 100755 codemagic_scripts/analyze_and_test.sh create mode 100755 codemagic_scripts/android_dependencies.sh create mode 100755 codemagic_scripts/android_key_properties.sh create mode 100755 codemagic_scripts/build_status.sh create mode 100755 codemagic_scripts/flutter_build.sh create mode 100755 codemagic_scripts/ios_signing_cocoapods.sh create mode 100755 codemagic_scripts/print_versions.sh create mode 100755 codemagic_scripts/project_setup.sh create mode 100644 docs/codemagic-integration.md diff --git a/codemagic.yaml b/codemagic.yaml new file mode 100644 index 00000000..86d02284 --- /dev/null +++ b/codemagic.yaml @@ -0,0 +1,167 @@ +workflows: + staging_android: + name: Staging Android + instance_type: linux_x2 + environment: + flutter: $FLUTTER_VERSION + android_signing: + - upload_keystore + groups: + - codemagic-staging + - codemagic-common-vars + triggering: + events: + - push + branch_patterns: + - pattern: fusion-app + include: true + scripts: + - name: Setup project (melos bootstrap) + script: sh ./codemagic_scripts/project_setup.sh + - name: Analyze + test (bloqueante) + script: sh ./codemagic_scripts/analyze_and_test.sh + - name: Print versions + script: sh ./codemagic_scripts/print_versions.sh android staging + - name: Android dependencies + script: sh ./codemagic_scripts/android_dependencies.sh + - name: Set up key.properties + script: sh ./codemagic_scripts/android_key_properties.sh + - name: Build Android app (APP_MODE=legacy) + script: sh ./codemagic_scripts/flutter_build.sh android staging legacy + - name: Mark success + script: touch ~/SUCCESS + artifacts: + - apps/mobile_app/build/app/outputs/bundle/stagingRelease/app-staging-release.aab + publishing: + google_play: + track: internal + credentials: $GCLOUD_SERVICE_ACCOUNT_CREDENTIALS + submit_as_draft: false + scripts: + - name: Report status + script: sh ./codemagic_scripts/build_status.sh android staging + + staging_ios: + name: Staging iOS + instance_type: mac_mini_m2 + integrations: + app_store_connect: SaveFamily ASC Key + environment: + flutter: $FLUTTER_VERSION + xcode: latest + ios_signing: + distribution_type: app_store + bundle_identifier: com.savefamily.app.stag + groups: + - codemagic-staging + - codemagic-common-vars + triggering: + events: + - push + branch_patterns: + - pattern: fusion-app + include: true + scripts: + - name: Setup project (melos bootstrap) + script: sh ./codemagic_scripts/project_setup.sh + - name: Analyze + test (bloqueante) + script: sh ./codemagic_scripts/analyze_and_test.sh + - name: iOS signing + CocoaPods + script: sh ./codemagic_scripts/ios_signing_cocoapods.sh + - name: Print versions + script: sh ./codemagic_scripts/print_versions.sh ios staging + - name: Build iOS app (APP_MODE=legacy) + script: sh ./codemagic_scripts/flutter_build.sh ios staging legacy + - name: Mark success + script: touch ~/SUCCESS + artifacts: + - apps/mobile_app/build/ios/ipa/*.ipa + publishing: + app_store_connect: + auth: integration + submit_to_testflight: true + scripts: + - name: Report status + script: sh ./codemagic_scripts/build_status.sh ios staging + + production_android: + name: Production Android + instance_type: linux_x2 + environment: + flutter: $FLUTTER_VERSION + android_signing: + - upload_keystore + groups: + - codemagic-production + - codemagic-common-vars + triggering: + events: + - tag + scripts: + - name: Setup project (melos bootstrap) + script: sh ./codemagic_scripts/project_setup.sh + - name: Analyze + test (bloqueante) + script: sh ./codemagic_scripts/analyze_and_test.sh + - name: Print versions + script: sh ./codemagic_scripts/print_versions.sh android production + - name: Android dependencies + script: sh ./codemagic_scripts/android_dependencies.sh + - name: Set up key.properties + script: sh ./codemagic_scripts/android_key_properties.sh + - name: Build Android app (APP_MODE=legacy) + script: sh ./codemagic_scripts/flutter_build.sh android production legacy + - name: Mark success + script: touch ~/SUCCESS + artifacts: + - apps/mobile_app/build/app/outputs/bundle/productionRelease/app-production-release.aab + publishing: + google_play: + track: internal + credentials: $GCLOUD_SERVICE_ACCOUNT_CREDENTIALS + submit_as_draft: true + scripts: + - name: Report status + script: sh ./codemagic_scripts/build_status.sh android production + + production_ios: + name: Production iOS + instance_type: mac_mini_m2 + integrations: + app_store_connect: SaveFamily ASC Key + environment: + flutter: $FLUTTER_VERSION + xcode: latest + ios_signing: + distribution_type: app_store + bundle_identifier: com.savefamily.app + groups: + - codemagic-production + - codemagic-common-vars + triggering: + events: + - tag + scripts: + - name: Setup project (melos bootstrap) + script: sh ./codemagic_scripts/project_setup.sh + - name: Analyze + test (bloqueante) + script: sh ./codemagic_scripts/analyze_and_test.sh + - name: iOS signing + CocoaPods + script: sh ./codemagic_scripts/ios_signing_cocoapods.sh + - name: Print versions + script: sh ./codemagic_scripts/print_versions.sh ios production + - name: Build iOS app (APP_MODE=legacy) + script: sh ./codemagic_scripts/flutter_build.sh ios production legacy + - name: Mark success + script: touch ~/SUCCESS + artifacts: + - apps/mobile_app/build/ios/ipa/*.ipa + publishing: + app_store_connect: + auth: integration + submit_to_app_store: true + release_type: MANUAL + cancel_previous_submissions: true + copyright: 2026 SaveFamily + scripts: + - name: Report status + script: sh ./codemagic_scripts/build_status.sh ios production diff --git a/codemagic_scripts/analyze_and_test.sh b/codemagic_scripts/analyze_and_test.sh new file mode 100755 index 00000000..8bd88369 --- /dev/null +++ b/codemagic_scripts/analyze_and_test.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -euo pipefail + +melos run analyze --no-select +melos run test --no-select diff --git a/codemagic_scripts/android_dependencies.sh b/codemagic_scripts/android_dependencies.sh new file mode 100755 index 00000000..9a33e3e5 --- /dev/null +++ b/codemagic_scripts/android_dependencies.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -euo pipefail + +cd apps/mobile_app/android +./gradlew --version diff --git a/codemagic_scripts/android_key_properties.sh b/codemagic_scripts/android_key_properties.sh new file mode 100755 index 00000000..e2e4b9a5 --- /dev/null +++ b/codemagic_scripts/android_key_properties.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -euo pipefail + +cat > "$CM_BUILD_DIR/apps/mobile_app/android/key.properties" < "$CM_BUILD_DIR/apps/mobile_app/android/key.properties" <