Skip to content

Commit

Permalink
Fix android build and add Github Workflows run for building Android (#61
Browse files Browse the repository at this point in the history
)

* Create build-android.yml

* Update build-android.yml

* Update build-android.yml

* Update build.gradle

* Update build-android.yml

* Update gradle.properties

* Update build.gradle

* Update gradle.properties

* Update build-android.yml

* Update gradle.properties

* Update build.gradle

* Update gradle.properties

* Update build.gradle

* Update and rename build-android.yml to build-android-release.yml

* Create build-android-debug.yml

* Update build-android-release.yml

* Update build-android-debug.yml

* Update build-android-debug.yml

* Update build-android-release.yml

* Update and rename build-android-release.yml to build-android-release-aab.yml

* Create android-release-apk.yml

* Rename android-release-apk.yml to build-android-release-apk.yml

* Update and rename build-android-debug.yml to build-android-debug-aab.yml

* Create build-android-debug-apk.yml

* Update build-android-debug-aab.yml
  • Loading branch information
gaborszita authored Aug 22, 2024
1 parent c7e3666 commit 01156ee
Show file tree
Hide file tree
Showing 5 changed files with 200 additions and 6 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/build-android-debug-aab.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build Android App Debug AAB

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

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'

- name: Install NPM Packages
working-directory: app
run: npm i

- name: Decode and save the keystore file
working-directory: app/android/app
run: |
echo "${{ secrets.ANDROID_UPLOAD_KEYSTORE_FILE_BASE64 }}" | base64 --decode > my-upload-key.keystore
- name: Build Android App AAB
working-directory: app/android
run: ./gradlew bundleDebug
env:
KEYSTORE_FILE: my-upload-key.keystore
KEYSTORE_PASSWORD: ${{ secrets.ANDROID_UPLOAD_KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.ANDROID_UPLOAD_KEYSTORE_ALIAS }}
KEY_PASSWORD: ${{ secrets.ANDROID_UPLOAD_KEYSTORE_KEY_PASSWORD }}

- name: Upload AAB
uses: actions/upload-artifact@v4
with:
name: app-debug.aab
path: app/android/app/build/outputs/bundle/release/app-release.aab
47 changes: 47 additions & 0 deletions .github/workflows/build-android-debug-apk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build Android App Debug APK

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

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'

- name: Install NPM Packages
working-directory: app
run: npm i

- name: Decode and save the keystore file
working-directory: app/android/app
run: |
echo "${{ secrets.ANDROID_UPLOAD_KEYSTORE_FILE_BASE64 }}" | base64 --decode > my-upload-key.keystore
- name: Build Android App APK
working-directory: app/android
run: ./gradlew assembleDebug
env:
KEYSTORE_FILE: my-upload-key.keystore
KEYSTORE_PASSWORD: ${{ secrets.ANDROID_UPLOAD_KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.ANDROID_UPLOAD_KEYSTORE_ALIAS }}
KEY_PASSWORD: ${{ secrets.ANDROID_UPLOAD_KEYSTORE_KEY_PASSWORD }}

- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: app-debug.apk
path: app/android/app/build/outputs/bundle/release/app-release.aab
47 changes: 47 additions & 0 deletions .github/workflows/build-android-release-aab.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build Android App Release AAB

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

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'

- name: Install NPM Packages
working-directory: app
run: npm i

- name: Decode and save the keystore file
working-directory: app/android/app
run: |
echo "${{ secrets.ANDROID_UPLOAD_KEYSTORE_FILE_BASE64 }}" | base64 --decode > my-upload-key.keystore
- name: Build Android App AAB
working-directory: app/android
run: ./gradlew bundleRelease
env:
KEYSTORE_FILE: my-upload-key.keystore
KEYSTORE_PASSWORD: ${{ secrets.ANDROID_UPLOAD_KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.ANDROID_UPLOAD_KEYSTORE_ALIAS }}
KEY_PASSWORD: ${{ secrets.ANDROID_UPLOAD_KEYSTORE_KEY_PASSWORD }}

- name: Upload AAB
uses: actions/upload-artifact@v4
with:
name: app-release.aab
path: app/android/app/build/outputs/bundle/release/app-release.aab
47 changes: 47 additions & 0 deletions .github/workflows/build-android-release-apk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build Android App Release APK

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

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'

- name: Install NPM Packages
working-directory: app
run: npm i

- name: Decode and save the keystore file
working-directory: app/android/app
run: |
echo "${{ secrets.ANDROID_UPLOAD_KEYSTORE_FILE_BASE64 }}" | base64 --decode > my-upload-key.keystore
- name: Build Android App APK
working-directory: app/android
run: ./gradlew assembleRelease
env:
KEYSTORE_FILE: my-upload-key.keystore
KEYSTORE_PASSWORD: ${{ secrets.ANDROID_UPLOAD_KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.ANDROID_UPLOAD_KEYSTORE_ALIAS }}
KEY_PASSWORD: ${{ secrets.ANDROID_UPLOAD_KEYSTORE_KEY_PASSWORD }}

- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: app-release.apk
path: app/android/app/build/outputs/apk/release/app-release.apk
18 changes: 12 additions & 6 deletions app/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ android {
keyAlias 'androiddebugkey'
keyPassword 'android'
}
release {
storeFile file(System.getenv('KEYSTORE_FILE'))
storePassword System.getenv('KEYSTORE_PASSWORD')
keyAlias System.getenv('KEY_ALIAS')
keyPassword System.getenv('KEY_PASSWORD')
}
}
buildTypes {
debug {
Expand All @@ -96,7 +102,7 @@ android {
release {
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.debug
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
Expand All @@ -107,12 +113,12 @@ dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")

//debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
//debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
// exclude group:'com.squareup.okhttp3', module:'okhttp'
//}
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.squareup.okhttp3', module:'okhttp'
}

//debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
} else {
Expand Down

0 comments on commit 01156ee

Please sign in to comment.