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" <