Skip to content

Commit 39d937b

Browse files
committed
update github action
1 parent 30c4150 commit 39d937b

File tree

5 files changed

+88
-39
lines changed

5 files changed

+88
-39
lines changed

.github/actions/build_android/action.yml

+23-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
name: 'Build Android App'
22
description: 'Builds the Android app using Fastlane'
3+
inputs:
4+
firebaseAPIKey:
5+
required: true
6+
keystorePath:
7+
required: true
8+
keystoreAlias:
9+
required: true
10+
keystorePassword:
11+
required: true
12+
keystoreKeyPassword:
13+
required: true
314

415
runs:
516
using: 'composite'
@@ -26,11 +37,21 @@ runs:
2637
node-version-file: .nvmrc
2738

2839
- name: Build Android Library with Fastlane
29-
run: cd android && fastlane android local
40+
run: |
41+
cd android
42+
fastlane android local
3043
shell: bash
44+
env:
45+
FIREBASE_API_KEY: ${{ inputs.firebaseAPIKey }}
46+
ANDROID_KEYSTORE_PATH: ${{ inputs.keystorePath }}
47+
ANDROID_KEYSTORE_PASSWORD: ${{ inputs.keystorePassword }}
48+
ANDROID_KEYSTORE_ALIAS: ${{ inputs.keystoreAlias }}
49+
ANDROID_KEYSTORE_KEY_PASSWORD: ${{ inputs.keystoreKeyPassword }}
3150

3251
- name: Copy Android Library to Shared Directory
33-
run: mkdir -p ${{ github.workspace }}/artifacts/android && cp ./artifacts/app-production-debug.apk ${{ github.workspace }}/artifacts/android/app-production-debug.apk
52+
run: |
53+
mkdir -p ${{ github.workspace }}/artifacts/android
54+
cp ./artifacts/app-production-debug.apk ${{ github.workspace }}/artifacts/android/app-production-debug.apk
3455
shell: bash
3556

3657
- name: Upload apk to artifact

.github/workflows/BuildAndroid.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: "Build Android"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v3
18+
19+
- name: Retrieve the secrets and decode it to a file
20+
env:
21+
UPLOAD_KEYSTORE_BASE64: ${{ secrets.UPLOAD_KEYSTORE_BASE64 }}
22+
PLAY_STORE_CREDENTIALS_BASE64: ${{ secrets.PLAY_STORE_CREDENTIALS_BASE64 }}
23+
run: |
24+
echo $UPLOAD_KEYSTORE_BASE64 | base64 --decode > ./android/keystores/upload.keystore
25+
echo $PLAY_STORE_CREDENTIALS_BASE64 | base64 --decode > ./android/fastlane/play-store-credentials.json
26+
shell: bash
27+
28+
- name: Build Android apk
29+
uses: ./.github/actions/build_android
30+
with:
31+
firebaseAPIKey: ${{ secrets.FIREBASE_API_KEY }}
32+
keystorePath: ${{ env.ANDROID_KEYSTORE_PATH }}
33+
keystoreAlias: ${{ secrets.ANDROID_KEYSTORE_ALIAS }}
34+
keystorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
35+
keystoreKeyPassword: ${{ secrets.ANDROID_KEYSTORE_KEY_PASSWORD }}

.github/workflows/test.yml

-20
This file was deleted.

android/app/google-services.json

+26-8
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,47 @@
11
{
22
"project_info": {
3-
"project_number": "788164346630",
4-
"project_id": "make-it-native-test",
5-
"storage_bucket": "make-it-native-test.appspot.com"
3+
"project_number": "542084943474",
4+
"firebase_url": "https://mendix-developerapp.firebaseio.com",
5+
"project_id": "mendix-developerapp",
6+
"storage_bucket": "mendix-developerapp.appspot.com"
67
},
78
"client": [
89
{
910
"client_info": {
10-
"mobilesdk_app_id": "1:788164346630:android:8abda4292fe590982d1487",
11+
"mobilesdk_app_id": "1:542084943474:android:2ca19794e96659b1da7ceb",
1112
"android_client_info": {
1213
"package_name": "com.mendix.developerapp.mx10"
1314
}
1415
},
15-
"oauth_client": [],
16+
"oauth_client": [
17+
{
18+
"client_id": "542084943474-kuqtb0msdmjroc74mf9t9oui5if4046i.apps.googleusercontent.com",
19+
"client_type": 3
20+
}
21+
],
1622
"api_key": [
1723
{
18-
"current_key": "AIzaSyD3pLyuEY38P44jR1hHYr00qKwOL_kJm_k"
24+
"current_key": "{{firebase-api-key}}"
1925
}
2026
],
2127
"services": {
2228
"appinvite_service": {
23-
"other_platform_oauth_client": []
29+
"other_platform_oauth_client": [
30+
{
31+
"client_id": "542084943474-kuqtb0msdmjroc74mf9t9oui5if4046i.apps.googleusercontent.com",
32+
"client_type": 3
33+
},
34+
{
35+
"client_id": "542084943474-03rk9m3agr20fs8fnjg4if2kosog0iil.apps.googleusercontent.com",
36+
"client_type": 2,
37+
"ios_info": {
38+
"bundle_id": "com.mendix.developerapp.native.mx10"
39+
}
40+
}
41+
]
2442
}
2543
}
2644
}
2745
],
2846
"configuration_version": "1"
29-
}
47+
}

android/fastlane/Fastfile

+4-9
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,17 @@
66

77
default_platform(:android)
88

9-
ENV["GRADLE_BINTRAY_REPO"] = ENV["NEXUS_BINTRAY_PROXY_URL"]
10-
ENV["GRADLE_JITPACK_REPO"] = ENV["NEXUS_JITPACK_PROXY_URL"]
11-
129
GOOGLE_PLAY_VERSION = sh("node -p -e \"require('../../package.json')['store-versions']['google-play']\"").chomp
1310
BUILD_NUMBER = ENV["BUILD_NUMBER"]
11+
TEST = ENV["TEST"]
1412
ORIGINAL_CHANGELOG_PATH = "../../CHANGELOG.android.txt"
1513
FASTLANE_CHANGELOG_PATH = "./metadata/android/en-US/changelogs/default.txt"
1614
versionCodeOffset = 304
1715

1816
platform :android do
1917
before_all do
2018
Dir.chdir("../..") do
21-
sh("npm", "ci", "--legacy-peer-deps")
19+
sh("npm", "ci")
2220
# Special hack to work-around alpine linux problem - File.getCanonicalPath is failing without a reason:
2321
sh("find node_modules -name '*.gradle' -type f -exec sed -i.bak '/canonicalPath/d' {} +")
2422
end
@@ -37,7 +35,6 @@ platform :android do
3735
desc "Build apk and install in the simulator"
3836
lane :debug_internal do
3937
UI.message("Installing dependencies")
40-
sh("npm", "i", "--legacy-peer-deps")
4138
gradleOptions = {
4239
"android.injected.version.code" => BUILD_NUMBER.to_i() + versionCodeOffset,
4340
"android.injected.version.name" => "#{GOOGLE_PLAY_VERSION}.dev",
@@ -74,10 +71,8 @@ platform :android do
7471

7572
UI.message "Replacing Firebase API keys from environment variables"
7673
Dir.chdir("../app") do
77-
firebaseApiKey1 = ENV["FIREBASE_API_KEY_1"] || "FIREBASE_API_KEY_1"
78-
sh("sed -i 's/{{firebase-api-key-1}}/#{firebaseApiKey1}/g' google-services.json")
79-
firebaseApiKey2 = ENV["FIREBASE_API_KEY_2"] || "FIREBASE_API_KEY_2"
80-
sh("sed -i 's/{{firebase-api-key-2}}/#{firebaseApiKey2}/g' google-services.json")
74+
firebaseApiKey = ENV["FIREBASE_API_KEY"] || "FIREBASE_API_KEY"
75+
sh("sed -i 's/{{firebase-api-key}}/#{firebaseApiKey}/g' google-services.json")
8176
end
8277

8378
if options[:submit] == true

0 commit comments

Comments
 (0)