Skip to content

Commit

Permalink
update github action
Browse files Browse the repository at this point in the history
  • Loading branch information
UrazAkgultan committed May 23, 2024
1 parent 30c4150 commit 9a3fd92
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 18 deletions.
25 changes: 23 additions & 2 deletions .github/actions/build_android/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
name: 'Build Android App'
description: 'Builds the Android app using Fastlane'
inputs:
firebaseAPIKey:
required: true
keystorePath:
required: true
keystoreAlias:
required: true
keystorePassword:
required: true
keystoreKeyPassword:
required: true

runs:
using: 'composite'
Expand All @@ -26,11 +37,21 @@ runs:
node-version-file: .nvmrc

- name: Build Android Library with Fastlane
run: cd android && fastlane android local
run: |
cd android
fastlane android local
shell: bash
env:
FIREBASE_API_KEY: ${{ inputs.firebaseAPIKey }}
ANDROID_KEYSTORE_PATH: ${{ inputs.keystorePath }}
ANDROID_KEYSTORE_PASSWORD: ${{ inputs.keystorePassword }}
ANDROID_KEYSTORE_ALIAS: ${{ inputs.keystoreAlias }}
ANDROID_KEYSTORE_KEY_PASSWORD: ${{ inputs.keystoreKeyPassword }}

- name: Copy Android Library to Shared Directory
run: mkdir -p ${{ github.workspace }}/artifacts/android && cp ./artifacts/app-production-debug.apk ${{ github.workspace }}/artifacts/android/app-production-debug.apk
run: |
mkdir -p ${{ github.workspace }}/artifacts/android
cp ./artifacts/app-production-debug.apk ${{ github.workspace }}/artifacts/android/app-production-debug.apk
shell: bash

- name: Upload apk to artifact
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/BuildAndroid.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Build Android"

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Retrieve the secrets and decode it to a file
run: |
echo $UPLOAD_KEYSTORE_BASE64 | base64 --decode > ./android/keystores/upload.keystore
echo $PLAY_STORE_CREDENTIALS_BASE64 | base64 --decode > ./android/fastlane/play-store-credentials.json
shell: bash

- name: Build Android apk
uses: ./.github/actions/build_android
with:
firebaseAPIKey: ${{ secrets.FIREBASE_API_KEY }}
keystorePath: ${{ env.ANDROID_KEYSTORE_PATH }}
keystoreAlias: ${{ secrets.ANDROID_KEYSTORE_ALIAS }}
keystorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
keystoreKeyPassword: ${{ secrets.ANDROID_KEYSTORE_KEY_PASSWORD }}
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ jobs:

- name: Build Android apk
uses: ./.github/actions/build_android
env:
UPLOAD_KEYSTORE_BASE64: ${{ secrets.UPLOAD_KEYSTORE_BASE64 }}
PLAY_STORE_CREDENTIALS_BASE64: ${{ secrets.PLAY_STORE_CREDENTIALS_BASE64 }}
34 changes: 26 additions & 8 deletions android/app/google-services.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,47 @@
{
"project_info": {
"project_number": "788164346630",
"project_id": "make-it-native-test",
"storage_bucket": "make-it-native-test.appspot.com"
"project_number": "542084943474",
"firebase_url": "https://mendix-developerapp.firebaseio.com",
"project_id": "mendix-developerapp",
"storage_bucket": "mendix-developerapp.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:788164346630:android:8abda4292fe590982d1487",
"mobilesdk_app_id": "1:542084943474:android:2ca19794e96659b1da7ceb",
"android_client_info": {
"package_name": "com.mendix.developerapp.mx10"
}
},
"oauth_client": [],
"oauth_client": [
{
"client_id": "542084943474-kuqtb0msdmjroc74mf9t9oui5if4046i.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyD3pLyuEY38P44jR1hHYr00qKwOL_kJm_k"
"current_key": "{{firebase-api-key}}"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
"other_platform_oauth_client": [
{
"client_id": "542084943474-kuqtb0msdmjroc74mf9t9oui5if4046i.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "542084943474-03rk9m3agr20fs8fnjg4if2kosog0iil.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.mendix.developerapp.native.mx10"
}
}
]
}
}
}
],
"configuration_version": "1"
}
}
12 changes: 4 additions & 8 deletions android/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,17 @@

default_platform(:android)

ENV["GRADLE_BINTRAY_REPO"] = ENV["NEXUS_BINTRAY_PROXY_URL"]
ENV["GRADLE_JITPACK_REPO"] = ENV["NEXUS_JITPACK_PROXY_URL"]

GOOGLE_PLAY_VERSION = sh("node -p -e \"require('../../package.json')['store-versions']['google-play']\"").chomp
BUILD_NUMBER = ENV["BUILD_NUMBER"]
TEST = ENV["TEST"]
ORIGINAL_CHANGELOG_PATH = "../../CHANGELOG.android.txt"
FASTLANE_CHANGELOG_PATH = "./metadata/android/en-US/changelogs/default.txt"
versionCodeOffset = 304

platform :android do
before_all do
Dir.chdir("../..") do
sh("npm", "ci", "--legacy-peer-deps")
sh("npm", "ci")
# Special hack to work-around alpine linux problem - File.getCanonicalPath is failing without a reason:
sh("find node_modules -name '*.gradle' -type f -exec sed -i.bak '/canonicalPath/d' {} +")
end
Expand Down Expand Up @@ -74,10 +72,8 @@ platform :android do

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

if options[:submit] == true
Expand Down

0 comments on commit 9a3fd92

Please sign in to comment.