From 1154333400562b36a2b436b70f79bfd43a0266ab Mon Sep 17 00:00:00 2001 From: Volodymyr Stelmashchuk Date: Tue, 4 Jul 2023 17:35:37 +0300 Subject: [PATCH] Ci new 2 (#85) * new ci * new ci * new ci * android fix * remove night build * fix google plist * try ci android build * clear ci * try new versions * migrate build apps to pull request * new ci * new ci * build prod ios * fixed location of google sevice info plist * fixed prod deploy --- .github/workflows/nightly_deploy.yml | 141 ------------------------ .github/workflows/pr.yml | 72 ++++++++++++ .github/workflows/prod_deploy.yml | 32 +++--- androidApp/build.gradle.kts | 5 + androidApp/proguard-rules.pro | 8 ++ gradle.properties | 4 +- iosApp/iosApp.xcodeproj/project.pbxproj | 16 +-- settings.gradle.kts | 2 +- 8 files changed, 111 insertions(+), 169 deletions(-) delete mode 100644 .github/workflows/nightly_deploy.yml create mode 100644 androidApp/proguard-rules.pro diff --git a/.github/workflows/nightly_deploy.yml b/.github/workflows/nightly_deploy.yml deleted file mode 100644 index a1de048..0000000 --- a/.github/workflows/nightly_deploy.yml +++ /dev/null @@ -1,141 +0,0 @@ -name: Publish Nightly build - -on: - push: - branches: - - main - workflow_dispatch: - -jobs: - prepare_deploy: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Set env - id: last_tag - run: echo "LAST_TAG=$(git tag --sort=committerdate | tail -1)" >> $GITHUB_OUTPUT - - uses: actions-ecosystem/action-bump-semver@v1 - id: bump-semver - with: - current_version: ${{ steps.last_tag.outputs.LAST_TAG }} - level: patch - - run: | - git config user.name github-actions - git config user.email github-actions@github.com - git tag ${{ steps.bump-semver.outputs.new_version }} - git push --tags - - name: "Set output" - id: set-output - run: | - echo "mix_drinks_mobile_version_name=${{ steps.bump-semver.outputs.new_version }}" >> $GITHUB_OUTPUT - - IFS='.' read -r major minor patch <<< "${{ steps.bump-semver.outputs.new_version }}" - mix_drinks_mobile_version_code=$((major * 10000 + minor * 100 + patch)) - - echo "mix_drinks_mobile_version_code=${mix_drinks_mobile_version_code}" >> $GITHUB_OUTPUT - - name: "Print output" - run: | - echo -e "Version name is: \n ${{ steps.set-output.outputs.mix_drinks_mobile_version_name }}" - echo -e "Version code is: \n ${{ steps.set-output.outputs.mix_drinks_mobile_version_code }}" - outputs: - output_write_mix_drinks_mobile_version_name: ${{ steps.set-output.outputs.mix_drinks_mobile_version_name }} - output_write_mix_drinks_mobile_version_code: ${{ steps.set-output.outputs.mix_drinks_mobile_version_code }} - deploy_android: - needs: [ prepare_deploy ] - env: - MIXDRINKS_MOBILE_APP_VERSION_NAME: ${{ needs.prepare_deploy.outputs.output_write_mix_drinks_mobile_version_name }} - MIXDRINKS_MOBILE_APP_VERSION_CODE: ${{ needs.prepare_deploy.outputs.output_write_mix_drinks_mobile_version_code }} - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - name: "Setup Gradle" - uses: gradle/gradle-build-action@v2 - - - name: "Build bundle release" - run: gradle android:bundleRelease - - - uses: r0adkll/sign-android-release@v1 - name: "Sign app aab file" - id: sign_app - with: - releaseDirectory: androidApp/build/outputs/bundle/release - signingKeyBase64: ${{ secrets.MIXDRINKS_ANDROID_SIGNING_KEY }} - alias: ${{ secrets.MIXDRINKS_ANDROID_ALIAS }} - keyStorePassword: ${{ secrets.MIXDRINKS_ANDROID_KEY_STORE_PASSWORD }} - keyPassword: ${{ secrets.MIXDRINKS_ANDROID_KEY_PASSWORD }} - env: - BUILD_TOOLS_VERSION: "30.0.2" - - - uses: actions/upload-artifact@v3 - with: - name: "Upload AAB file as artifact" - path: ${{steps.sign_app.outputs.signedReleaseFile}} - - - name: "Upload to Google Play" - uses: r0adkll/upload-google-play@v1 - with: - serviceAccountJsonPlainText: ${{ secrets.MIXDRINKS_ANDROID_DEPLOY_SERVICE_ACCOUNT_JSON }} - packageName: org.mixdrinks.app - releaseFiles: ${{steps.sign_app.outputs.signedReleaseFile}} - track: beta - status: completed - - deploy_ios: - needs: [ prepare_deploy ] - env: - MIXDRINKS_MOBILE_APP_VERSION_NAME: ${{ needs.prepare_deploy.outputs.output_write_mix_drinks_mobile_version_name }} - MIXDRINKS_MOBILE_APP_VERSION_CODE: ${{ needs.prepare_deploy.outputs.output_write_mix_drinks_mobile_version_code }} - runs-on: macos-12 - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 - with: - distribution: 'zulu' - java-version: '17' - - - name: "Setup Gradle" - uses: gradle/gradle-build-action@v2 - - - name: "Build xcworkspace" - run: ./gradlew podInstall - - - name: "Setup app version" - uses: yanamura/ios-bump-version@v1 - with: - version: ${{ env.MIXDRINKS_MOBILE_APP_VERSION_NAME }} - build-number: ${{ env.MIXDRINKS_MOBILE_APP_VERSION_CODE }} - project-path: iosApp - - - name: "Build IOS App" - uses: yukiarrr/ios-build-action@v1.9.1 - with: - project-path: iosApp/iosApp.xcodeproj - p12-base64: ${{ secrets.MIXDRINKS_IOS_P12_BASE64 }} - mobileprovision-base64: ${{ secrets.MIXDRINKS_IOS_BUILD_PROVISION_PROFILE_BASE64_TESTFLY }} - code-signing-identity: "iPhone Distribution" - team-id: ${{ secrets.MIXDRINKS_IOS_TEAM_ID }} - certificate-password: ${{ secrets.MIXDRINKS_IOS_CERTIFICATE_PASSWORD }} - export-options: iosApp/exportOptionsTestFly.plist - workspace-path: iosApp/iosApp.xcworkspace - export-method: "ad-hoc" - - name: "Upload IPA file as artifact" - uses: actions/upload-artifact@v3 - with: - name: IOS IPA - path: "output.ipa" - - - name: Install private API key P8 - env: - PRIVATE_API_KEY_BASE64: ${{ secrets.MIXDRINKS_IOS_APPSTORE_API_PRIVATE_KEY }} - API_KEY: ${{ secrets.MIXDRINKS_IOS_APPSTORE_API_KEY_ID }} - run: | - mkdir -p ~/private_keys - echo -n "$PRIVATE_API_KEY_BASE64" | base64 --decode --output ~/private_keys/AuthKey_$API_KEY.p8 - - - name: "Upload IPA file to test flight" - env: - API_KEY: ${{ secrets.MIXDRINKS_IOS_APPSTORE_API_KEY_ID }} - API_ISSUER: ${{ secrets.MIXDRINKS_IOS_APPSTORE_ISSUER_ID }} - run: xcrun altool --output-format xml --upload-app -f output.ipa -t ios --apiKey $API_KEY --apiIssuer $API_ISSUER diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 5857406..ec2995b 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -20,3 +20,75 @@ jobs: uses: gradle/gradle-build-action@v2.5.1 with: arguments: check + + build_android: + env: + MIXDRINKS_MOBILE_APP_VERSION_NAME: "0.0.1" + MIXDRINKS_MOBILE_APP_VERSION_CODE: 10 + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + architecture: x64 + + - name: Build with Gradle + uses: gradle/gradle-build-action@v2.5.1 + with: + arguments: androidApp:bundleRelease + + - uses: r0adkll/sign-android-release@v1 + name: "Sign app aab file" + id: sign_app + with: + releaseDirectory: androidApp/build/outputs/bundle/release + signingKeyBase64: ${{ secrets.MIXDRINKS_ANDROID_SIGNING_KEY }} + alias: ${{ secrets.MIXDRINKS_ANDROID_ALIAS }} + keyStorePassword: ${{ secrets.MIXDRINKS_ANDROID_KEY_STORE_PASSWORD }} + keyPassword: ${{ secrets.MIXDRINKS_ANDROID_KEY_PASSWORD }} + env: + BUILD_TOOLS_VERSION: "30.0.2" + + - uses: actions/upload-artifact@v3 + with: + name: "Upload AAB file as artifact" + path: ${{steps.sign_app.outputs.signedReleaseFile}} + + + build_ios: + env: + MIXDRINKS_MOBILE_APP_VERSION_NAME: "0.0.1" + MIXDRINKS_MOBILE_APP_VERSION_CODE: 10 + runs-on: macos-12 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + architecture: x64 + + - name: Build pod install + uses: gradle/gradle-build-action@v2.5.1 + with: + arguments: podInstall + + - name: "Build IOS App" + uses: yukiarrr/ios-build-action@v1.11.0 + with: + project-path: iosApp/iosApp.xcodeproj + p12-base64: ${{ secrets.MIXDRINKS_IOS_P12_BASE64 }} + mobileprovision-base64: ${{ secrets.PROD_MIXDRINKS_IOS_BUILD_PROVISION_PROFILE_BASE64 }} + code-signing-identity: "iPhone Distribution" + team-id: ${{ secrets.MIXDRINKS_IOS_TEAM_ID }} + certificate-password: ${{ secrets.MIXDRINKS_IOS_CERTIFICATE_PASSWORD }} + export-options: iosApp/exportOptionsRelease.plist + workspace-path: iosApp/iosApp.xcworkspace + export-method: "app-store" + - name: "Upload IPA file as artifact" + uses: actions/upload-artifact@v3 + with: + name: IOS IPA + path: "output.ipa" diff --git a/.github/workflows/prod_deploy.yml b/.github/workflows/prod_deploy.yml index 673ad2d..383707e 100644 --- a/.github/workflows/prod_deploy.yml +++ b/.github/workflows/prod_deploy.yml @@ -50,11 +50,16 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - - name: "Setup Gradle" - uses: gradle/gradle-build-action@v2 + - uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + architecture: x64 - - name: "Build bundle release" - run: gradle android:bundleRelease + - name: Build with Gradle + uses: gradle/gradle-build-action@v2.5.1 + with: + arguments: androidApp:bundleRelease - uses: r0adkll/sign-android-release@v1 name: "Sign app aab file" @@ -92,24 +97,17 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 with: - distribution: 'zulu' java-version: '17' + distribution: 'adopt' + architecture: x64 - - name: "Setup Gradle" - uses: gradle/gradle-build-action@v2 - - - name: "Build xcworkspace" - run: ./gradlew podInstall - - - name: "Setup app version" - uses: yanamura/ios-bump-version@v1 + - name: Build pod install + uses: gradle/gradle-build-action@v2.5.1 with: - version: ${{ env.MIXDRINKS_MOBILE_APP_VERSION_NAME }} - build-number: ${{ env.MIXDRINKS_MOBILE_APP_VERSION_CODE }} - project-path: iosApp + arguments: podInstall - name: "Build IOS App" - uses: yukiarrr/ios-build-action@v1.9.1 + uses: yukiarrr/ios-build-action@v1.11.0 with: project-path: iosApp/iosApp.xcodeproj p12-base64: ${{ secrets.MIXDRINKS_IOS_P12_BASE64 }} diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index 1204294..3b5aed5 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -42,6 +42,11 @@ android { isMinifyEnabled = true isShrinkResources = true this.resValue("string", "app_name", "MixDrinks") + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } getByName("debug") { isDebuggable = true diff --git a/androidApp/proguard-rules.pro b/androidApp/proguard-rules.pro new file mode 100644 index 0000000..c96109f --- /dev/null +++ b/androidApp/proguard-rules.pro @@ -0,0 +1,8 @@ +-dontwarn org.bouncycastle.jsse.BCSSLSocket +-dontwarn org.bouncycastle.jsse.BCSSLParameters +-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider +-dontwarn org.conscrypt.* +-dontwarn org.openjsse.javax.net.ssl.SSLParameters +-dontwarn org.openjsse.javax.net.ssl.SSLSocket +-dontwarn org.openjsse.net.ssl.OpenJSSE +-dontwarn org.slf4j.impl.StaticLoggerBinder diff --git a/gradle.properties b/gradle.properties index 327ea4b..1b199e0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,6 +16,6 @@ android.compileSdk=34 android.targetSdk=34 android.minSdk=24 #Versions -kotlin.version=1.8.10 +kotlin.version=1.8.20 agp.version=8.0.0 -compose.version=1.4.0 +compose.version=1.4.1 diff --git a/iosApp/iosApp.xcodeproj/project.pbxproj b/iosApp/iosApp.xcodeproj/project.pbxproj index c707ccf..e1800a3 100644 --- a/iosApp/iosApp.xcodeproj/project.pbxproj +++ b/iosApp/iosApp.xcodeproj/project.pbxproj @@ -13,7 +13,7 @@ 6203DCF02A481D4A00F64586 /* MainViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6203DCEF2A481D4A00F64586 /* MainViewModel.swift */; }; 621F45832A42371300920E95 /* FirebaseAnalytics in Frameworks */ = {isa = PBXBuildFile; productRef = 621F45822A42371300920E95 /* FirebaseAnalytics */; }; 621F45852A42371300920E95 /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = 621F45842A42371300920E95 /* FirebaseCrashlytics */; }; - 62C862D02A52F3CF003DD588 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 62C862CF2A52F3CF003DD588 /* GoogleService-Info.plist */; }; + 62EB7C842A543B330001B5C0 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 62EB7C832A543B330001B5C0 /* GoogleService-Info.plist */; }; 62FBF4DA2A42388700B31CDC /* FirebaseAuth in Frameworks */ = {isa = PBXBuildFile; productRef = 62FBF4D92A42388700B31CDC /* FirebaseAuth */; }; 7555FF83242A565900829871 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF82242A565900829871 /* ContentView.swift */; }; CFDB58B53BB94DE262B13C24 /* Pods_iosApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B1049432C0C2B312090ABF6 /* Pods_iosApp.framework */; }; @@ -26,7 +26,7 @@ 4FF3202A603A284706412EDC /* Pods-iosApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iosApp.debug.xcconfig"; path = "Target Support Files/Pods-iosApp/Pods-iosApp.debug.xcconfig"; sourceTree = ""; }; 6203DCEF2A481D4A00F64586 /* MainViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainViewModel.swift; sourceTree = ""; }; 6252FC0D2A3F5B2000D38B32 /* iosApp.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = iosApp.entitlements; sourceTree = ""; }; - 62C862CF2A52F3CF003DD588 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../../Downloads/GoogleService-Info.plist"; sourceTree = ""; }; + 62EB7C832A543B330001B5C0 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 6B1049432C0C2B312090ABF6 /* Pods_iosApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_iosApp.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 7555FF7B242A565900829871 /* MixDrinks.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MixDrinks.app; sourceTree = BUILT_PRODUCTS_DIR; }; 7555FF82242A565900829871 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; @@ -69,7 +69,7 @@ 7555FF72242A565900829871 = { isa = PBXGroup; children = ( - 62C862CF2A52F3CF003DD588 /* GoogleService-Info.plist */, + 62EB7C832A543B330001B5C0 /* GoogleService-Info.plist */, AB1DB47929225F7C00F7AF9C /* Configuration */, 7555FF7D242A565900829871 /* iosApp */, 7555FF7C242A565900829871 /* Products */, @@ -189,7 +189,7 @@ files = ( 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */, 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */, - 62C862D02A52F3CF003DD588 /* GoogleService-Info.plist in Resources */, + 62EB7C842A543B330001B5C0 /* GoogleService-Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -393,7 +393,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = iosApp/iosApp.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; @@ -413,7 +413,7 @@ "PRODUCT_BUNDLE_IDENTIFIER[sdk=iphoneos*]" = org.mixdrinks.app9LJW42P73L; PRODUCT_NAME = "${APP_NAME}"; PROVISIONING_PROFILE_SPECIFIER = ""; - "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Development(signIn)"; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Production(signIn)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; @@ -429,7 +429,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = iosApp/iosApp.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; @@ -449,7 +449,7 @@ "PRODUCT_BUNDLE_IDENTIFIER[sdk=iphoneos*]" = org.mixdrinks.app9LJW42P73L; PRODUCT_NAME = "${APP_NAME}"; PROVISIONING_PROFILE_SPECIFIER = ""; - "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Development(signIn)"; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Production(signIn)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; diff --git a/settings.gradle.kts b/settings.gradle.kts index 00baf54..11315ef 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -20,7 +20,7 @@ pluginManagement { kotlin("android").version(kotlinVersion) kotlin("plugin.serialization").version(kotlinVersion) - id("com.google.devtools.ksp").version("${kotlinVersion}-1.0.9") + id("com.google.devtools.ksp").version("${kotlinVersion}-1.0.11") id("de.jensklingenberg.ktorfit") version "1.0.0" id("com.android.application").version(agpVersion)