Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
fix test fly build (#84)
Browse files Browse the repository at this point in the history
* Fixe deploy to test fly

* fix yaml

* Implemet back handle for ios

* fix test ci

* migrate to java 17
  • Loading branch information
VovaStelmashchuk authored Jul 3, 2023
1 parent 34f3ce0 commit 6de67e5
Show file tree
Hide file tree
Showing 12 changed files with 186 additions and 139 deletions.
244 changes: 123 additions & 121 deletions .github/workflows/nightly_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,139 +1,141 @@
name: Publish Nightly build

on:
push:
branches:
- main
- try_new_version_code_generator
workflow_dispatch:
push:
branches:
- main
workflow_dispatch:

jobs:
prepare_deploy:
runs-on: ubuntu-22.04
steps:
- name: "Checkout"
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
- uses: actions-ecosystem/action-bump-semver@v1
id: bump-semver
with:
current_version: ${{ steps.get-latest-tag.outputs.tag }}
level: patch
- uses: actions-ecosystem/action-push-tag@v1
with:
tag: ${{ steps.bump-semver.outputs.new_version }}
- name: "Set output"
id: set-output
run: |
echo "mix_drinks_mobile_version_name=${{ steps.bump-semver.outputs.new_version }}" >> $GITHUB_OUTPUT
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 [email protected]
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))
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
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
- 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: 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}}
- 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
- 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'
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: "Setup Gradle"
uses: gradle/gradle-build-action@v2

- name: "Build xcworkspace"
run: ./gradlew podInstall
- 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: "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/[email protected]
with:
project-path: iosApp/iosApp.xcodeproj
p12-base64: ${{ secrets.MIXDRINKS_IOS_P12_BASE64 }}
mobileprovision-base64: ${{ secrets.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 }}
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: "Build IOS App"
uses: yukiarrr/[email protected]
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: 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
- 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
6 changes: 2 additions & 4 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ jobs:
- name: Set up JDK 11 for x64
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'
architecture: x64
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@ccb4328a959376b642e027874838f60f8e596de3
- name: Build with Gradle
uses: gradle/gradle-build-action@9cf99034d287025d4ee4838498a346d99521aaa4
uses: gradle/gradle-build-action@v2.5.1
with:
arguments: check
3 changes: 1 addition & 2 deletions androidApp/src/androidMain/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.mixdrinks.app">
xmlns:tools="http://schemas.android.com/tools">

<application
android:allowBackup="true"
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ org.jetbrains.compose.experimental.uikit.enabled=true
kotlin.native.cacheKind=none
#Android
android.useAndroidX=true
android.compileSdk=33
android.targetSdk=33
android.compileSdk=34
android.targetSdk=34
android.minSdk=24
#Versions
kotlin.version=1.8.10
agp.version=7.4.2
agp.version=8.0.0
compose.version=1.4.0
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
13 changes: 13 additions & 0 deletions iosApp/exportOptionsTestFly.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>ad-hoc</string>
<key>provisioningProfiles</key>
<dict>
<key>org.mixdrinks.app9LJW42P73L</key>
<string>TestFly(signIn)</string>
</dict>
</dict>
</plist>
12 changes: 8 additions & 4 deletions iosApp/iosApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +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 */; };
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 */; };
Expand All @@ -25,6 +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 = "<group>"; };
6203DCEF2A481D4A00F64586 /* MainViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainViewModel.swift; sourceTree = "<group>"; };
6252FC0D2A3F5B2000D38B32 /* iosApp.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = iosApp.entitlements; sourceTree = "<group>"; };
62C862CF2A52F3CF003DD588 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../../Downloads/GoogleService-Info.plist"; sourceTree = "<group>"; };
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 = "<group>"; };
Expand Down Expand Up @@ -67,6 +69,7 @@
7555FF72242A565900829871 = {
isa = PBXGroup;
children = (
62C862CF2A52F3CF003DD588 /* GoogleService-Info.plist */,
AB1DB47929225F7C00F7AF9C /* Configuration */,
7555FF7D242A565900829871 /* iosApp */,
7555FF7C242A565900829871 /* Products */,
Expand Down Expand Up @@ -186,6 +189,7 @@
files = (
058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */,
058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */,
62C862D02A52F3CF003DD588 /* GoogleService-Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -389,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 Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
Expand All @@ -409,7 +413,7 @@
"PRODUCT_BUNDLE_IDENTIFIER[sdk=iphoneos*]" = org.mixdrinks.app9LJW42P73L;
PRODUCT_NAME = "${APP_NAME}";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Production(signIn)";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Development(signIn)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
Expand All @@ -425,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 Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
Expand All @@ -445,7 +449,7 @@
"PRODUCT_BUNDLE_IDENTIFIER[sdk=iphoneos*]" = org.mixdrinks.app9LJW42P73L;
PRODUCT_NAME = "${APP_NAME}";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Production(signIn)";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Development(signIn)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pluginManagement {
id("org.jetbrains.compose").version(composeVersion)

kotlin("native.cocoapods").version(kotlinVersion)
id("com.google.gms.google-services").version("4.3.14")
id("com.google.gms.google-services").version("4.3.15")
id("com.google.firebase.crashlytics").version("2.9.6")
}
}
Expand Down
Loading

0 comments on commit 6de67e5

Please sign in to comment.