mirror of
https://github.com/hmalik144/easy_cc_flutter.git
synced 2025-12-10 03:05:34 +00:00
165 lines
4.9 KiB
YAML
165 lines
4.9 KiB
YAML
version: 2.1
|
|
orbs:
|
|
android: circleci/android@2.0.0
|
|
macos: circleci/macos@2.0.1
|
|
|
|
parameters:
|
|
flutter_version:
|
|
type: string
|
|
default: "3.3.3"
|
|
xcode_version:
|
|
type: string
|
|
default: "13.3.0"
|
|
flutter_download_url:
|
|
type: string
|
|
default: "https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_2.5.1-stable.zip"
|
|
|
|
executors:
|
|
cirrusci:
|
|
docker:
|
|
- image: cirrusci/flutter:<< pipeline.parameters.flutter_version >>
|
|
ios-flutter:
|
|
macos:
|
|
xcode: << pipeline.parameters.xcode_version >>
|
|
environment:
|
|
FL_OUTPUT_DIR: output
|
|
|
|
commands:
|
|
flutter_project_setup:
|
|
steps:
|
|
- checkout
|
|
- run: flutter doctor
|
|
- run: flutter pub get
|
|
- run: flutter pub run build_runner build
|
|
- run: flutter analyze lib
|
|
- run: flutter test
|
|
android_setup:
|
|
steps:
|
|
- run:
|
|
name: Keystore variables
|
|
command: |
|
|
echo "$GOOGLE_PLAY_KEY" > "android/playstore.json"
|
|
echo "$RELEASE_KEYSTORE_BASE64" | base64 --decode > "android/app/release_keystore.jks"
|
|
fastlane_setup_android:
|
|
steps:
|
|
- restore_cache:
|
|
key: 1-android-gems-{{ checksum "android/Gemfile.lock" }}
|
|
- run:
|
|
name: Configure Fastlane Android
|
|
command: |
|
|
gem install bundler
|
|
cd android
|
|
bundle check || bundle install
|
|
bundle update fastlane
|
|
- save_cache:
|
|
key: 1-android-gems-{{ checksum "android/Gemfile.lock" }}
|
|
paths:
|
|
- android/vendor/bundle
|
|
ios_setup:
|
|
steps:
|
|
- checkout
|
|
- restore_cache:
|
|
key: flutter-cache-<< pipeline.parameters.flutter_version >>-ios-bin
|
|
- run:
|
|
name: download flutter SDK
|
|
command: if ! test -d "flutter"; then curl -o flutter_sdk.zip << pipeline.parameters.flutter_download_url >>; fi
|
|
- run:
|
|
name: unzip flutter SDK
|
|
command: if test -f "flutter_sdk.zip"; then unzip flutter_sdk.zip; fi
|
|
- run:
|
|
name: export flutter path
|
|
command: echo 'export PATH="$PATH:`pwd`/flutter/bin"' >> $BASH_ENV
|
|
- save_cache:
|
|
key: flutter-cache-<< pipeline.parameters.flutter_version >>-ios-bin
|
|
paths:
|
|
- flutter
|
|
fastlane_setup_ios:
|
|
steps:
|
|
- restore_cache:
|
|
key: 1-ios-gems-{{ checksum "ios/Gemfile.lock" }}
|
|
- run:
|
|
name: Configure Fastlane iOS
|
|
command: |
|
|
gem install bundler:2.2.26
|
|
cd ios
|
|
bundle check || bundle install
|
|
bundle update fastlane
|
|
- run:
|
|
name: Install Firebase CLI
|
|
command: |
|
|
curl -sL firebase.tools | bash
|
|
- save_cache:
|
|
key: 1-ios-gems-{{ checksum "ios/Gemfile.lock" }}
|
|
paths:
|
|
- ios/vendor/bundle
|
|
workflows:
|
|
version: 2
|
|
all-branch:
|
|
jobs:
|
|
- build-all-branch:
|
|
filters:
|
|
branches:
|
|
ignore: master
|
|
distribute-android:
|
|
jobs:
|
|
- distribute-android:
|
|
filters:
|
|
branches:
|
|
only: master
|
|
distribute-ios:
|
|
jobs:
|
|
- distribute-ios:
|
|
filters:
|
|
branches:
|
|
only: ios_deployment
|
|
jobs:
|
|
build-all-branch:
|
|
docker:
|
|
- image: cirrusci/flutter:<< pipeline.parameters.flutter_version >>
|
|
steps:
|
|
- flutter_project_setup
|
|
distribute-android:
|
|
docker:
|
|
- image: cirrusci/flutter:<< pipeline.parameters.flutter_version >>
|
|
steps:
|
|
- flutter_project_setup
|
|
- android_setup
|
|
- fastlane_setup_android
|
|
- run:
|
|
name: Build Android APK
|
|
command: flutter build apk --dart-define=currencyApiKey=%CURRENCY_API_KEY%
|
|
- store_artifacts:
|
|
path: build/app/outputs/flutter-apk/app-release.apk
|
|
- run:
|
|
name: Upload to PlayStore
|
|
command: |
|
|
pwd
|
|
cd android
|
|
bundle exec fastlane supply --apk ../build/app/outputs/flutter-apk/app-release.apk --rollout 1
|
|
distribute-ios:
|
|
executor: ios-flutter
|
|
steps:
|
|
- ios_setup
|
|
- fastlane_setup_ios
|
|
- run:
|
|
name: Production variables
|
|
command: |
|
|
echo "$ENV_PROD" | base64 --decode > ".env"
|
|
echo "$ENV_DEV" | base64 --decode > ".dev.env"
|
|
- run:
|
|
name: Build iOS Production App
|
|
command: |
|
|
flutter clean && flutter pub get && cd ios && rm Podfile.lock && pod install && cd ..
|
|
- run:
|
|
name: Replace ShareMe file
|
|
command: |
|
|
echo "$SwiftFlutterShareMePlugin" | base64 --decode > "/Users/distiller/project/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_share_me-1.2.0/ios/Classes/SwiftFlutterShareMePlugin.swift"
|
|
- run:
|
|
name: Build and Upload iOS Archive IPA
|
|
command: |
|
|
cd ios
|
|
bundle exec fastlane prod
|
|
- store_artifacts:
|
|
path: ios/output/gym/Runner.ipa
|
|
- store_artifacts:
|
|
path: ios/output/gym/Runner.app.dSYM.zip |