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 40c2858
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 41 deletions.
66 changes: 41 additions & 25 deletions .github/actions/build_android/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,49 @@ runs:
using: 'composite'

steps:
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'

- name: Install Fastlane
run: gem install fastlane
- name: Retrieve the secrets and decode it to a file
run: |
echo $UPLOAD_KEYSTORE_BASE64 | base64 --decode > android/keystore/upload.keystore
echo $PLAY_STORE_CREDENTIALS_BASE64 | base64 --decode > android/fastlane/play-store-credentials.json
mv android/keystore/upload.keystore ${{ github.workspace }}/artifacts/android/upload.keystore
mv android/fastlane/play-store-credentials.json ${{ github.workspace }}/artifacts/android/play-store-credentials.json
shell: bash

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc

- name: Build Android Library with Fastlane
run: cd android && fastlane android local
shell: bash

- 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
shell: bash
# - name: Set up JDK
# uses: actions/setup-java@v3
# with:
# distribution: 'temurin'
# java-version: 17

# - name: Set up Ruby
# uses: ruby/setup-ruby@v1
# with:
# ruby-version: '2.7'

# - name: Install Fastlane
# run: gem install fastlane
# shell: bash

# - name: Setup Node
# uses: actions/setup-node@v3
# with:
# node-version-file: .nvmrc

# - name: Build Android Library with Fastlane
# run: cd android && fastlane android local
# shell: bash
# env:
# FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }}
# ANDROID_KEYSTORE_PATH: ${{ env.ANDROID_KEYSTORE_PATH }}
# ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
# ANDROID_KEYSTORE_ALIAS: ${{ secrets.ANDROID_KEYSTORE_ALIAS }}
# ANDROID_KEYSTORE_KEY_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_KEY_PASSWORD }}

# - 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
# shell: bash

- name: Upload apk to artifact
uses: actions/upload-artifact@v4
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/BuildAndroid.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
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: |
ls android
echo U0VMQU0= | base64 --decode > ./android/test.txt
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: Upload apk to artifact
uses: actions/upload-artifact@v4
with:
name: android
path: ./android/
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 40c2858

Please sign in to comment.