Skip to content

Commit 0f22e80

Browse files
committed
Update secrets for android
1 parent 5ec0d18 commit 0f22e80

File tree

5 files changed

+114
-31
lines changed

5 files changed

+114
-31
lines changed

.github/actions/build-android/action.yaml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ inputs:
2020
keystoreKeyPassword:
2121
description: 'Key password for the Android keystore'
2222
required: true
23+
playStoreCredentialsBase64:
24+
description: 'Base64-encoded Play Store credentials JSON file'
25+
required: true
2326

2427
runs:
2528
using: composite
@@ -53,10 +56,26 @@ runs:
5356
echo $GOOGLE_SERVICES_JSON | base64 --decode > android/app/google-services.json
5457
shell: bash
5558

59+
- name: Decode upload.keystore
60+
env:
61+
KEYSTORE_BASE64: ${{ inputs.keystoreBase64 }}
62+
run: |
63+
mkdir -p android/keystores
64+
echo $KEYSTORE_BASE64 | base64 --decode > android/keystores/upload.keystore
65+
shell: bash
66+
67+
- name: Decode Play Store credentials
68+
env:
69+
PLAY_STORE_CREDENTIALS_BASE64: ${{ inputs.playStoreCredentialsBase64 }}
70+
run: |
71+
mkdir -p android/fastlane
72+
echo $PLAY_STORE_CREDENTIALS_BASE64 | base64 --decode > android/fastlane/play-store-credentials.json
73+
shell: bash
74+
5675
- name: Build Android Library with Fastlane
5776
run: |
5877
cd android
59-
fastlane android local
78+
fastlane android internal submit:false
6079
shell: bash
6180
env:
6281
FIREBASE_API_KEY: ${{ inputs.firebaseAPIKey }}

.github/actions/build-ios/action.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ runs:
2323
run: pod install --project-directory=ios
2424
shell: bash
2525

26-
- name: Build iOS Debug App
27-
run: cd ios && fastlane ios debug_internal
26+
- name: Run Fastlane
27+
run: cd ios && fastlane ios release
2828
shell: bash
2929

.github/workflows/MiNe2e.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,22 @@ jobs:
106106
UPLOAD_KEYSTORE_BASE64: ${{ secrets.UPLOAD_KEYSTORE_BASE64 }}
107107
PLAY_STORE_CREDENTIALS_BASE64: ${{ secrets.PLAY_STORE_CREDENTIALS_BASE64 }}
108108
run: |
109+
mkdir -p ./android/keystores
109110
echo $UPLOAD_KEYSTORE_BASE64 | base64 --decode > ./android/keystores/upload.keystore
110111
echo $PLAY_STORE_CREDENTIALS_BASE64 | base64 --decode > ./android/fastlane/play-store-credentials.json
111112
shell: bash
112113

113114
- name: Build Android apk
114-
uses: ./.github/actions/build_android
115+
uses: ./.github/actions/build-android
115116
with:
117+
google_services_json: ${{ secrets.GOOGLE_SERVICES_JSON }}
116118
firebaseAPIKey: ${{ secrets.FIREBASE_API_KEY }}
117-
keystorePath: ${{ env.ANDROID_KEYSTORE_PATH }}
119+
keystoreBase64: ${{ secrets.UPLOAD_KEYSTORE_BASE64 }}
118120
keystoreAlias: ${{ secrets.ANDROID_KEYSTORE_ALIAS }}
119121
keystorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
120122
keystoreKeyPassword: ${{ secrets.ANDROID_KEYSTORE_KEY_PASSWORD }}
123+
playStoreCredentialsBase64: ${{ secrets.PLAY_STORE_CREDENTIALS_BASE64 }}
124+
keystorePath: ./android/keystores/upload.keystore
121125

122126
ios-app:
123127
runs-on: macOS-15

android/fastlane/Fastfile

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,23 @@ platform :android do
4343
UI.message("Building DeveloperApp")
4444
gradle(task: "assemble", build_type: "Debug", flavor: "Production", flags: "--stacktrace", properties: gradleOptions)
4545

46-
# UI.message("Installing APK into Android device/simulator")
47-
# lane_context[SharedValues::GRADLE_ALL_APK_OUTPUT_PATHS].each do |apk|
48-
# begin
49-
# sh("adb reverse tcp:8080 tcp:8080")
50-
# sh("adb reverse tcp:8083 tcp:8083")
51-
# sh("adb install -r #{apk}")
52-
# end
53-
# end
46+
UI.message("Installing APK into Android device/simulator")
47+
lane_context[SharedValues::GRADLE_ALL_APK_OUTPUT_PATHS].each do |apk|
48+
begin
49+
sh("adb reverse tcp:8080 tcp:8080")
50+
sh("adb reverse tcp:8083 tcp:8083")
51+
sh("adb install -r #{apk}")
52+
end
53+
end
5454
end
5555

5656
desc "Build new bundle and upload to Internal track"
5757
lane :internal do |options|
5858
FileUtils.copy(ORIGINAL_CHANGELOG_PATH, FASTLANE_CHANGELOG_PATH)
59-
versionCode = google_play_track_version_codes(track: "internal").max() + 1
60-
versionName = GOOGLE_PLAY_VERSION + "." + BUILD_NUMBER
59+
#versionCode = google_play_track_version_codes(track: "internal").max() + 1
60+
versionCode = 1
61+
# versionName = GOOGLE_PLAY_VERSION + "." + BUILD_NUMBER
62+
versionName = BUILD_NUMBER
6163

6264
gradleOptions = {
6365
# Gradle 7.3 removed support for dynamic versioning through android.injected.version.code
@@ -93,6 +95,7 @@ platform :android do
9395
track: "internal",
9496
skip_upload_images: true,
9597
skip_upload_apk: true,
98+
json_key: "./fastlane/play-store-credentials.json",
9699
)
97100
else
98101
UI.message "Building APK version #{versionName}(#{versionCode}) for internal tests"

ios/fastlane/Fastfile

Lines changed: 73 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,78 @@
1+
# Constants
2+
APPLE_STORE_VERSION = sh("node -p -e \"require('../../package.json')['store-versions']['apple-store']\"").chomp
3+
4+
default_platform(:ios)
5+
16
platform :ios do
2-
before_all do
3-
UI.message("Installing dependencies")
4-
sh("npm", "ci", "--legacy-peer-deps") # Install npm dependencies
5-
cocoapods # Install CocoaPods dependencies
6-
end
7+
desc "Upload a new build to AppStore"
8+
lane :release do
9+
keychain_name = "MiN_10_keychain"
10+
create_keychain(
11+
name: keychain_name,
12+
default_keychain: true,
13+
unlock: true,
14+
timeout: 3600,
15+
password: ENV["KEYCHAIN_PASSWORD"],
16+
lock_when_sleeps: false
17+
)
18+
sh("npm", "ci", "--legacy-peer-deps")
19+
cocoapods
720

8-
desc "Builds DeveloperApp for Debug and generates an .ipa file"
9-
lane :debug_internal do
10-
UI.message("Building DeveloperApp for Debug and generating .ipa")
11-
gym(
12-
scheme: "DeveloperApp", # Replace with your app's scheme name
13-
configuration: "Debug", # Use Debug configuration
14-
output_directory: "./build", # Directory where the .ipa will be saved
15-
output_name: "DeveloperApp-Debug.ipa", # Name of the .ipa file
16-
export_method: "development", # Use development export method for debug builds
17-
include_bitcode: false, # Optional: Exclude bitcode for faster builds
18-
include_symbols: true, # Include debug symbols for debugging
21+
api_key = app_store_connect_api_key(
22+
key_id: ENV["APP_STORE_CONNECT_KEY_ID"],
23+
issuer_id: ENV["APP_STORE_CONNECT_ISSUER_ID"],
24+
key_content: ENV["APP_STORE_CONNECT_KEY_CONTENT"],
25+
duration: 1200, # Session Length in seconds (maximum: 1200).
26+
)
27+
28+
UI.message("Disabling automatic signing on Xcode")
29+
disable_automatic_code_signing
30+
31+
UI.message("Get the certificates and profiles")
32+
match(
33+
type:"appstore",
34+
api_key:api_key,
35+
keychain_name:keychain_name,
36+
keychain_password: ENV["KEYCHAIN_PASSWORD"],
37+
git_basic_authorization:ENV["MATCH_GIT_BASIC_AUTHORIZATION"],
38+
readonly: false,
39+
)
40+
41+
UI.message("Set version number")
42+
increment_version_number(
43+
version_number: APPLE_STORE_VERSION,
44+
)
45+
46+
UI.message("Get the latest build number from AppStore Connect")
47+
build_num = app_store_build_number(
48+
live: false,
49+
initial_build_number: 0,
50+
api_key: api_key,
51+
version: APPLE_STORE_VERSION,
52+
)
53+
54+
UI.message("Set build number")
55+
increment_build_number(
56+
xcodeproj: "developerapp.xcodeproj",
57+
build_number: build_num + 1,
58+
)
59+
60+
61+
UI.message("Replacing Google Maps API key from environment variables")
62+
Dir.chdir("../DeveloperApp/Config") do
63+
googleMapsApiKey = ENV["GOOGLE_MAPS_API_KEY"] || "GOOGLE_MAPS_API_KEY"
64+
sh("sed -i '' 's/{{google-maps-api-key}}/#{googleMapsApiKey}/g' ApiKeys.xcconfig")
65+
end
66+
67+
build_app(
68+
workspace: "DeveloperApp.xcworkspace",
69+
scheme: "DeveloperApp",
70+
build_path:"./build",
71+
output_directory:"./build"
72+
)
73+
upload_to_testflight(
74+
skip_waiting_for_build_processing: true,
1975
)
2076
end
77+
2178
end

0 commit comments

Comments
 (0)