Skip to content

Commit

Permalink
build: test app distribution (#62)
Browse files Browse the repository at this point in the history
* chore: rename the android namespace

* fix: update google-services

* build: app distribution

* deps: update gemfile
  • Loading branch information
phoebus-84 authored Jun 13, 2024
1 parent b18062e commit 41be1b2
Show file tree
Hide file tree
Showing 10 changed files with 200 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_alpha_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
KEYSTORE_STORE_PASSWORD: ${{ secrets.KEYSTORE_STORE_PASSWORD }}
with:
lane: alpha
- run: mv release verifier.apk
- run: mv release.apk verifier.apk
- name: upload binary artifacts
uses: actions/upload-artifact@v4
with:
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/distribute.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: '📢 and 📲'

on:
pull_request:
branches: ['main']
jobs:
distribute:
runs-on: ubuntu-latest
environment: test
steps:
- uses: dyne/pnpm@main
with:
submodules: true
- uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: '17'
- name: Decode Keystore File
uses: timheuer/base64-to-file@v1
id: android_keystore
with:
fileName: android_keystore.keystore
encodedString: ${{ secrets.ANDROID_KEYSTORE_FILE }}
- name: Decode Service Account File
uses: timheuer/base64-to-file@v1
id: service_account
with:
fileName: play-store-credentials.json
encodedString: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true

- uses: maierj/[email protected]
env:
KEYSTORE_PATH: ${{ steps.android_keystore.outputs.filePath }}
SERVICE_ACCOUNT_PATH: ${{ steps.service_account.outputs.filePath }}
KEYSTORE_KEY_ALIAS: ${{ secrets.KEYSTORE_KEY_ALIAS }}
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
KEYSTORE_STORE_PASSWORD: ${{ secrets.KEYSTORE_STORE_PASSWORD }}
FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }}
PULL_REQUEST_NUMBER: ${{ github.event.number }}
PULL_REQUEST_TITLE: ${{ github.event.pull_request.title }}
with:
lane: distribute
40 changes: 28 additions & 12 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ GEM
aws-sigv4 (1.8.0)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
base64 (0.2.0)
claide (1.1.0)
colored (1.2)
colored2 (3.1.2)
Expand Down Expand Up @@ -105,19 +106,28 @@ GEM
xcodeproj (>= 1.13.0, < 2.0.0)
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3)
fastlane-plugin-bundletool (1.0.9)
fastlane-plugin-bundletool (1.0.10)
fastlane-plugin-firebase_app_distribution (0.9.1)
google-apis-firebaseappdistribution_v1 (~> 0.3.0)
google-apis-firebaseappdistribution_v1alpha (~> 0.2.0)
fastlane-plugin-increment_version_code (0.4.3)
fastlane-plugin-increment_version_name (0.0.10)
fastlane-plugin-load_json (0.0.1)
gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.53.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-core (0.11.2)
google-apis-core (0.15.0)
addressable (~> 2.5, >= 2.5.1)
googleauth (>= 0.16.2, < 2.a)
googleauth (~> 1.9)
httpclient (>= 2.8.1, < 3.a)
mini_mime (~> 1.0)
representable (~> 3.0)
retriable (>= 2.0, < 4.a)
rexml
webrick
google-apis-firebaseappdistribution_v1 (0.3.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-firebaseappdistribution_v1alpha (0.2.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-iamcredentials_v1 (0.17.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-playcustomapp_v1 (0.13.0)
Expand All @@ -127,7 +137,7 @@ GEM
google-cloud-core (1.6.1)
google-cloud-env (>= 1.0, < 3.a)
google-cloud-errors (~> 1.0)
google-cloud-env (2.1.0)
google-cloud-env (2.1.1)
faraday (>= 1.0, < 3.a)
google-cloud-errors (1.3.1)
google-cloud-storage (1.45.0)
Expand All @@ -138,7 +148,7 @@ GEM
google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
mini_mime (~> 1.0)
googleauth (1.9.1)
googleauth (1.11.0)
faraday (>= 1.0, < 3.a)
google-cloud-env (~> 2.1)
jwt (>= 1.4, < 3.0)
Expand All @@ -151,36 +161,39 @@ GEM
httpclient (2.8.3)
jmespath (1.6.2)
json (2.7.1)
jwt (2.7.1)
jwt (2.8.1)
base64
mini_magick (4.12.0)
mini_mime (1.1.5)
multi_json (1.15.0)
multipart-post (2.3.0)
multipart-post (2.4.1)
nanaimo (0.3.0)
naturally (2.2.1)
optparse (0.1.1)
os (1.1.4)
plist (3.7.0)
public_suffix (5.0.4)
public_suffix (5.0.5)
rake (13.1.0)
representable (3.2.0)
declarative (< 0.1.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.2.6)
rexml (3.2.9)
strscan
rouge (2.0.7)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
security (0.1.3)
signet (0.18.0)
signet (0.19.0)
addressable (~> 2.8)
faraday (>= 0.17.5, < 3.a)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
simctl (1.6.10)
CFPropertyList
naturally
strscan (3.1.0)
terminal-notifier (2.0.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
Expand All @@ -191,7 +204,6 @@ GEM
tty-cursor (~> 0.7)
uber (0.1.0)
unicode-display_width (2.5.0)
webrick (1.8.1)
word_wrap (1.0.0)
xcodeproj (1.23.0)
CFPropertyList (>= 2.3.3, < 4.0)
Expand All @@ -212,6 +224,10 @@ PLATFORMS
DEPENDENCIES
fastlane
fastlane-plugin-bundletool
fastlane-plugin-firebase_app_distribution
fastlane-plugin-increment_version_code
fastlane-plugin-increment_version_name
fastlane-plugin-load_json

BUNDLED WITH
2.4.10
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apply plugin: 'com.android.application'

android {
namespace "eu.forkbomb.didroom.verifier"
namespace "com.didroom.verifier"
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "eu.forkbomb.didroom.verifier"
applicationId "com.didroom.verifier"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
Expand Down
31 changes: 25 additions & 6 deletions android/app/google-services.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,40 @@
{
"project_info": {
"project_number": "918939182691",
"project_id": "didroom-verifier",
"storage_bucket": "didroom-verifier.appspot.com"
"project_number": "438470006888",
"project_id": "didroom-wallet",
"storage_bucket": "didroom-wallet.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:918939182691:android:31c521f2c5b1b6996efa56",
"mobilesdk_app_id": "1:438470006888:android:82a519ab225fa88d1b83dd",
"android_client_info": {
"package_name": "eu.forkbomb.didroom.verifier"
"package_name": "com.didroom.verifier"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyA1SFYxD2V2vFagZ7mrinOM36myw6y_JEg"
"current_key": "AIzaSyBrG5kuJY4hWAGPHgpdlh8q_xZLSqaU7eg"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:438470006888:android:1e776045ca0237541b83dd",
"android_client_info": {
"package_name": "com.didroom.wallet"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyBrG5kuJY4hWAGPHgpdlh8q_xZLSqaU7eg"
}
],
"services": {
Expand Down
36 changes: 31 additions & 5 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,41 @@
<?xml version='1.0' encoding='utf-8'?>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme" android:usesCleartextTraffic="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:exported="true" android:label="@string/title_activity_main" android:launchMode="singleTask" android:name=".MainActivity" android:theme="@style/AppTheme.NoActionBarLaunch" android:windowSoftInputMode="adjustPan">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">

<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
android:name=".MainActivity"
android:label="@string/title_activity_main"
android:theme="@style/AppTheme.NoActionBarLaunch"
android:launchMode="singleTask"
android:exported="true">

<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

</activity>
<provider android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true" android:name="androidx.core.content.FileProvider">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"></meta-data>
</provider>
</application>

<!-- Permissions -->

<uses-permission android:name="android.permission.INTERNET" />
</manifest>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package eu.forkbomb.didroom.verifier;
package com.didroom.verifier;

import com.getcapacitor.BridgeActivity;

Expand Down
2 changes: 1 addition & 1 deletion capacitor.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CapacitorConfig } from '@capacitor/cli';

const config: CapacitorConfig = {
appId: 'eu.forkbomb.didroom.verifier',
appId: 'com.didroom.verifier',
appName: 'verifier',
webDir: 'build',
server: {
Expand Down
53 changes: 52 additions & 1 deletion fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ KEYSTORE_PATH = ENV["KEYSTORE_PATH"]
KEYSTORE_KEY_ALIAS = ENV["KEYSTORE_KEY_ALIAS"]
KEYSTORE_KEY_PASSWORD = ENV["KEYSTORE_KEY_PASSWORD"]
KEYSTORE_STORE_PASSWORD = ENV["KEYSTORE_STORE_PASSWORD"]
APK_OUTPUT_PATH = "./release"
APK_OUTPUT_PATH = "./release.apk"
CACHE_PATH = "./.cache"
FIREBASE_APP_ID = ENV["FIREBASE_APP_ID"]
SERVICE_ACCOUNT_PATH = ENV["SERVICE_ACCOUNT_PATH"]
PULL_REQUEST_NUMBER = ENV["PULL_REQUEST_NUMBER"]
PULL_REQUEST_TITLE = ENV["PULL_REQUEST_TITLE"]


platform :android do
Expand Down Expand Up @@ -55,4 +59,51 @@ platform :android do
cache_path: CACHE_PATH
)
end

lane :distribute do
sh "pnpm install -g @ionic/cli"
sh "pnpm install"
sh "cp ../.env.example ../.env"
sh "ionic cap sync android"
sh "ionic cap build android --no-open"
package = load_json(json_path: "./package.json")
increment_version_code(
gradle_file_path: "./android/app/build.gradle",
version_code: PULL_REQUEST_NUMBER
)
increment_version_name(
gradle_file_path: "./android/app/build.gradle",
version_name: package['version'] + "-" + PULL_REQUEST_NUMBER
)
gradle(
task: "clean bundleRelease",
project_dir: 'android/',
print_command: false,
properties: {
"android.injected.signing.store.file" => "#{KEYSTORE_PATH}",
"android.injected.signing.store.password" => "#{KEYSTORE_STORE_PASSWORD}",
"android.injected.signing.key.alias" => "#{KEYSTORE_KEY_ALIAS}",
"android.injected.signing.key.password" => "#{KEYSTORE_KEY_PASSWORD}",
})
aab_path = "android/app/build/outputs/bundle/release/app-release.aab"
bundletool(
bundletool_version: '1.16.0',
ks_path: KEYSTORE_PATH,
ks_password: KEYSTORE_STORE_PASSWORD,
ks_key_alias: KEYSTORE_KEY_ALIAS,
ks_key_alias_password: KEYSTORE_KEY_PASSWORD,
aab_path: aab_path,
apk_output_path: APK_OUTPUT_PATH,
verbose: true,
cache_path: CACHE_PATH
)

release = firebase_app_distribution(
app: FIREBASE_APP_ID,
service_credentials_file: SERVICE_ACCOUNT_PATH,
android_artifact_path: APK_OUTPUT_PATH,
groups: 'dyne',
release_notes: "#{PULL_REQUEST_TITLE}"
)
end
end
4 changes: 4 additions & 0 deletions fastlane/Pluginfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
# Ensure this file is checked in to source control!

gem 'fastlane-plugin-bundletool'
gem 'fastlane-plugin-firebase_app_distribution'
gem 'fastlane-plugin-load_json'
gem 'fastlane-plugin-increment_version_code'
gem 'fastlane-plugin-increment_version_name'

0 comments on commit 41be1b2

Please sign in to comment.