From a5859ca98ed26f7e600e4ffb80a79388aa8db16b Mon Sep 17 00:00:00 2001 From: Juraldinio Date: Wed, 30 Aug 2023 17:32:42 +0300 Subject: [PATCH] Remove unused rules for notification Added Firebase Add scripts for deploy Android application Fix increment application bundle version Increase version for upload in build phase Try fix deploy android Android deploy first Remove unwanted artefact deletion --- .after-merge-request.yml | 16 ++++---- example/android/app/build.gradle | 5 ++- example/android/app/google-services.json | 39 +++++++++++++++++++ .../flutter}/MainActivity.kt | 2 +- example/android/build.gradle | 1 + example/android/settings.gradle | 1 + toolchain/build_platforms.sh | 4 ++ toolchain/deploy_Android.sh | 10 +++++ toolchain/deploy_iOS.sh | 11 ++++-- 9 files changed, 75 insertions(+), 14 deletions(-) create mode 100644 example/android/app/google-services.json rename example/android/app/src/main/kotlin/tech/nut/{nut_player_example => nutplayer/flutter}/MainActivity.kt (72%) create mode 100755 toolchain/deploy_Android.sh mode change 100644 => 100755 toolchain/deploy_iOS.sh diff --git a/.after-merge-request.yml b/.after-merge-request.yml index 45696aa..2c196e6 100644 --- a/.after-merge-request.yml +++ b/.after-merge-request.yml @@ -38,7 +38,7 @@ ManualBuild: - chmod +x ./toolchain/build_platforms.sh - ./toolchain/build_platforms.sh device -DeployIOS: +Deploy: when: on_success allow_failure: false tags: @@ -60,9 +60,11 @@ DeployIOS: - tags script: - chmod +x ./toolchain/deploy_iOS.sh + - chmod +x ./toolchain/deploy_Android.sh - ./toolchain/deploy_iOS.sh ${IPA_DEPLOY_TARGET} ${IPA_PATH} ${IPA_FILE} iOS + - ./toolchain/deploy_Android.sh -DeployIOS_Feature: +Deploy_Feature: when: manual allow_failure: false tags: @@ -83,19 +85,19 @@ DeployIOS_Feature: - /^feature/ script: - chmod +x ./toolchain/deploy_iOS.sh + - chmod +x ./toolchain/deploy_Android.sh + - ./toolchain/deploy_Android.sh - ./toolchain/deploy_iOS.sh ${IPA_DEPLOY_TARGET} ${IPA_PATH} ${IPA_FILE} iOS notifyMessengerFail: when: on_failure needs: - - job: DeployIOS + - job: Deploy artifacts: false only: refs: - develop - tags - changes: - - ios/**/* stage: notify tags: - macos @@ -107,14 +109,12 @@ notifyMessengerFail: notifyMessengerSuccess: when: on_success needs: - - job: DeployIOS + - job: Deploy artifacts: false only: refs: - develop - tags - changes: - - ios/**/* stage: notify tags: - macos diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 9d901e6..6158499 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -2,6 +2,7 @@ plugins { id "com.android.application" id "kotlin-android" id "dev.flutter.flutter-gradle-plugin" + id 'com.google.gms.google-services' } def localProperties = new Properties() @@ -23,7 +24,7 @@ if (flutterVersionName == null) { } android { - namespace "tech.nut.nut_player_example" + namespace "tech.nut.nutplayer.flutter" compileSdkVersion flutter.compileSdkVersion ndkVersion flutter.ndkVersion @@ -42,7 +43,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "tech.nut.nut_player_example" + applicationId "tech.nut.nutplayer.flutter" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. minSdkVersion flutter.minSdkVersion diff --git a/example/android/app/google-services.json b/example/android/app/google-services.json new file mode 100644 index 0000000..ea2c11f --- /dev/null +++ b/example/android/app/google-services.json @@ -0,0 +1,39 @@ +{ + "project_info": { + "project_number": "803206890572", + "project_id": "nutplayer-flutter", + "storage_bucket": "nutplayer-flutter.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:803206890572:android:ad09971112d775d202e0e9", + "android_client_info": { + "package_name": "tech.nut.nutplayer.flutter" + } + }, + "oauth_client": [ + { + "client_id": "803206890572-omc4vdhgoe2rg6939c798s53v8564l6n.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyB7HEhQGvbebWG-B75L9DcSlq_n0EG_zTc" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "803206890572-omc4vdhgoe2rg6939c798s53v8564l6n.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/example/android/app/src/main/kotlin/tech/nut/nut_player_example/MainActivity.kt b/example/android/app/src/main/kotlin/tech/nut/nutplayer/flutter/MainActivity.kt similarity index 72% rename from example/android/app/src/main/kotlin/tech/nut/nut_player_example/MainActivity.kt rename to example/android/app/src/main/kotlin/tech/nut/nutplayer/flutter/MainActivity.kt index ca2afc5..4a530ad 100644 --- a/example/android/app/src/main/kotlin/tech/nut/nut_player_example/MainActivity.kt +++ b/example/android/app/src/main/kotlin/tech/nut/nutplayer/flutter/MainActivity.kt @@ -1,4 +1,4 @@ -package tech.nut.nut_player_example +package tech.nut.nutplayer.flutter import io.flutter.embedding.android.FlutterActivity diff --git a/example/android/build.gradle b/example/android/build.gradle index f7eb7f6..3adc6ed 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -8,6 +8,7 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:7.3.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath 'com.google.gms:google-services:+' } } diff --git a/example/android/settings.gradle b/example/android/settings.gradle index 55c4ca8..69953cc 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -12,6 +12,7 @@ pluginManagement { plugins { id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false + id 'com.google.gms.google-services' version '4.3.15' apply false } } diff --git a/toolchain/build_platforms.sh b/toolchain/build_platforms.sh index 75728ad..657c111 100755 --- a/toolchain/build_platforms.sh +++ b/toolchain/build_platforms.sh @@ -67,6 +67,10 @@ fi # iOS +#Sync versions and change build number for upload to TestFlight +BUNDLE_SHORT_VERSION=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "./ios/Runner/Info.plist") +/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $CI_PIPELINE_IID" ./ios/Runner/Info.plist + flutter build ipa \ --release \ --export-options-plist=../toolchain/NutPlayer-iOS-ExportOptions.plist diff --git a/toolchain/deploy_Android.sh b/toolchain/deploy_Android.sh new file mode 100755 index 0000000..8300979 --- /dev/null +++ b/toolchain/deploy_Android.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +RELEASE_NOTES="notes.txt" + +git log --pretty=format:'%h %s' -n 5 > $RELEASE_NOTES + +firebase appdistribution:distribute ./Result/app-release.apk \ + --app $K8S_FIREBASE_ANDROID_APPLICATION \ + --release-notes-file $RELEASE_NOTES \ + --groups QA diff --git a/toolchain/deploy_iOS.sh b/toolchain/deploy_iOS.sh old mode 100644 new mode 100755 index 908be82..840d0be --- a/toolchain/deploy_iOS.sh +++ b/toolchain/deploy_iOS.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + unlock_login_keychain() { if [ -z "$1" ]; then echo "Password parameter must be exists" @@ -32,7 +34,12 @@ if [ "$IPA_DEPLOY_TARGET" == "TESTFLIGHT" ]; then unlock_login_keychain "$K8S_SECRET_SPOCK" #upload - xcrun altool --upload-app --username "juraldinio@me.com" --password "$K8S_SECRET_NOTARIZATION" -t $PLATFORM --file $IPA_PATH/$IPA_FILE + xcrun altool \ + --upload-app \ + --username "juraldinio@me.com" \ + --password "$K8S_SECRET_NOTARIZATION" \ + -t $PLATFORM \ + --file $IPA_PATH/$IPA_FILE if [ "$?" != "0" ]; then echo >&2 "⛔️ Error: upload build failed"; @@ -55,5 +62,3 @@ else echo "Nothing to do" exit 1 fi - -rm -rf $IPA_PATH