Skip to content

Commit

Permalink
Merge pull request #275 from nimblehq/feature/268-build-and-distribut…
Browse files Browse the repository at this point in the history
…e-android-release-build
  • Loading branch information
luongvo authored Oct 27, 2023
2 parents e4fa0ad + 88ef4ab commit cfff3e0
Show file tree
Hide file tree
Showing 24 changed files with 131 additions and 44 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/android_deploy_production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
build_and_deploy_android:
name: Build & Deploy Android
name: Android - Deploy Production build to Firebase
runs-on: ubuntu-latest
environment: production
timeout-minutes: 30
Expand Down Expand Up @@ -45,14 +45,22 @@ jobs:
run: |
echo -e "$ENV" > .env
- name: Set up release signing configs
env:
ANDROID_RELEASE_KEYSTORE_BASE64: ${{ secrets.ANDROID_RELEASE_KEYSTORE_BASE64 }}
ANDROID_SIGNING_PROPERTIES: ${{ secrets.ANDROID_SIGNING_PROPERTIES }}
run: |
echo $ANDROID_RELEASE_KEYSTORE_BASE64 | base64 --decode > android/config/release.keystore
echo "$ANDROID_SIGNING_PROPERTIES" > android/signing.properties
# App Bundle requires Firebase connected to Play Store to upload https://appdistribution.page.link/KPoa
- name: Build Android apk
run: flutter build apk --flavor production --debug --build-number $GITHUB_RUN_NUMBER
run: flutter build apk --flavor production --release --build-number $GITHUB_RUN_NUMBER

- name: Deploy Android Production to Firebase
uses: wzieba/[email protected]
with:
appId: ${{ vars.FIREBASE_ANDROID_APP_ID }}
serviceCredentialsFileContent: ${{ secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON }}
groups: ${{ vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS }}
file: build/app/outputs/flutter-apk/app-production-debug.apk
file: build/app/outputs/flutter-apk/app-production-release.apk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
build_and_deploy_android:
name: Build & Deploy Android
name: Android - Deploy Production build to Play Store
runs-on: ubuntu-latest
environment: production
timeout-minutes: 30
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/android_deploy_staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
build_and_deploy_android:
name: Build & Deploy Android
name: Android - Deploy Staging build to Firebase
runs-on: ubuntu-latest
environment: staging
timeout-minutes: 30
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ios_deploy_staging_to_firebase.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: ios-deploy-to-staging
name: iOS - Deploy Staging build to Firebase
on:
# Trigger the workflow on push action
push:
branches:
- develop

jobs:
build_and_upload_staging_app_to_firebase:
name: Build And Upload iOS Staging Application To Firebase
build_and_deploy_ios:
name: iOS - Deploy Staging build to Firebase
runs-on: macOS-latest
environment: staging
env:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ios_deploy_to_app_store.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: ios-deploy-production-to-app-store
name: iOS - Deploy Production build to AppStore
on:
# Trigger the workflow on push action
push:
branches:
- main

jobs:
build_and_upload_to_app_store:
name: Build And Upload iOS Application Production To AppStore
build_and_deploy_ios:
name: iOS - Deploy Production build to AppStore
runs-on: macOS-latest
environment: production
timeout-minutes: 30
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ios_deploy_to_testflight.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: ios-deploy-production-to-testflight
name: iOS - Deploy Production build to TestFlight
on:
# Trigger the workflow on push action
push:
branches:
- main

jobs:
build_and_upload_to_testflight:
name: Build And Upload iOS Application Production To TestFlight
build_and_deploy_ios:
name: iOS - Deploy Production build to TestFlight
runs-on: macOS-latest
environment: production
timeout-minutes: 30
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
build_and_deploy_android:
name: Build & Deploy Android
name: Android - Deploy Production build to Firebase
runs-on: ubuntu-latest
environment: production
timeout-minutes: 30
Expand Down Expand Up @@ -39,14 +39,22 @@ jobs:
run: |
echo -e "$ENV" > .env
- name: Set up release signing configs
env:
ANDROID_RELEASE_KEYSTORE_BASE64: ${{#mustacheCase}}secrets.ANDROID_RELEASE_KEYSTORE_BASE64{{/mustacheCase}}
ANDROID_SIGNING_PROPERTIES: ${{#mustacheCase}}secrets.ANDROID_SIGNING_PROPERTIES{{/mustacheCase}}
run: |
echo $ANDROID_RELEASE_KEYSTORE_BASE64 | base64 --decode > android/config/release.keystore
echo "$ANDROID_SIGNING_PROPERTIES" > android/signing.properties
# App Bundle requires Firebase connected to Play Store to upload https://appdistribution.page.link/KPoa
- name: Build Android apk
run: flutter build apk --flavor production --debug --build-number $GITHUB_RUN_NUMBER
run: flutter build apk --flavor production --release --build-number $GITHUB_RUN_NUMBER

- name: Deploy Android Production to Firebase
uses: wzieba/[email protected]
with:
appId: ${{#mustacheCase}}vars.FIREBASE_ANDROID_APP_ID{{/mustacheCase}}
serviceCredentialsFileContent: ${{#mustacheCase}}secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON{{/mustacheCase}}
groups: ${{#mustacheCase}}vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS{{/mustacheCase}}
file: build/app/outputs/flutter-apk/app-production-debug.apk
file: build/app/outputs/flutter-apk/app-production-release.apk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
build_and_deploy_android:
name: Build & Deploy Android
name: Android - Deploy Production build to Play Store
runs-on: ubuntu-latest
environment: production
timeout-minutes: 30
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
build_and_deploy_android:
name: Build & Deploy Android
name: Android - Deploy Staging build to Firebase
runs-on: ubuntu-latest
environment: staging
timeout-minutes: 30
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: ios-deploy-to-staging
name: iOS - Deploy Staging build to Firebase
on:
# Trigger the workflow on push action
push:
branches:
- develop

jobs:
build_and_upload_staging_app_to_firebase:
name: Build And Upload iOS Staging Application To Firebase
build_and_deploy_ios:
name: iOS - Deploy Staging build to Firebase
runs-on: macOS-latest
environment: staging
env:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: ios-deploy-production-to-app-store
name: iOS - Deploy Production build to AppStore
on:
# Trigger the workflow on push action
push:
branches:
- main

jobs:
build_and_upload_to_app_store:
name: Build And Upload iOS Application Production To AppStore
build_and_deploy_ios:
name: iOS - Deploy Production build to AppStore
runs-on: macOS-latest
environment: production
timeout-minutes: 30
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: ios-deploy-production-to-testflight
name: iOS - Deploy Production build to TestFlight
on:
# Trigger the workflow on push action
push:
branches:
- main

jobs:
build_and_upload_to_testflight:
name: Build And Upload iOS Application Production To TestFlight
build_and_deploy_ios:
name: iOS - Deploy Production build to TestFlight
runs-on: macOS-latest
environment: production
timeout-minutes: 30
Expand Down
8 changes: 7 additions & 1 deletion bricks/template/__brick__/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@
### Setup

- Create these `.env` files in the root directory according to the flavors and add the required
environment variables. The example environment variable is in `.env.sample`.
environment variables. The example file is `.env.sample`.

- Staging: `.env.staging`

- Production: `.env`

- To make the Android release build,

- put the `release.keystore` at the `android/config` folder,

- create the `signing.properties` file to provide keystore credentials in the `android` folder. The example file is `signing.properties.sample`.

### Run

- Run code generator for JSON models, DI dependencies, etc:
Expand Down
24 changes: 24 additions & 0 deletions bricks/template/__brick__/android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

# Keep BuildConfig for Flutter Config https://github.com/ByneappLLC/flutter_config/blob/master/doc/ANDROID.md#android-setup
-keep class {{package_name.dotCase()}}.BuildConfig { *; }
14 changes: 11 additions & 3 deletions sample/.github/workflows/android_deploy_production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
build_and_deploy_android:
name: Build & Deploy Android
name: Android - Deploy Production build to Firebase
runs-on: ubuntu-latest
environment: production
timeout-minutes: 30
Expand Down Expand Up @@ -39,14 +39,22 @@ jobs:
run: |
echo -e "$ENV" > .env
- name: Set up release signing configs
env:
ANDROID_RELEASE_KEYSTORE_BASE64: ${{ secrets.ANDROID_RELEASE_KEYSTORE_BASE64 }}
ANDROID_SIGNING_PROPERTIES: ${{ secrets.ANDROID_SIGNING_PROPERTIES }}
run: |
echo $ANDROID_RELEASE_KEYSTORE_BASE64 | base64 --decode > android/config/release.keystore
echo "$ANDROID_SIGNING_PROPERTIES" > android/signing.properties
# App Bundle requires Firebase connected to Play Store to upload https://appdistribution.page.link/KPoa
- name: Build Android apk
run: flutter build apk --flavor production --debug --build-number $GITHUB_RUN_NUMBER
run: flutter build apk --flavor production --release --build-number $GITHUB_RUN_NUMBER

- name: Deploy Android Production to Firebase
uses: wzieba/[email protected]
with:
appId: ${{ vars.FIREBASE_ANDROID_APP_ID }}
serviceCredentialsFileContent: ${{ secrets.FIREBASE_DISTRIBUTION_CREDENTIAL_JSON }}
groups: ${{ vars.FIREBASE_DISTRIBUTION_TESTER_GROUPS }}
file: build/app/outputs/flutter-apk/app-production-debug.apk
file: build/app/outputs/flutter-apk/app-production-release.apk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
build_and_deploy_android:
name: Build & Deploy Android
name: Android - Deploy Production build to Play Store
runs-on: ubuntu-latest
environment: production
timeout-minutes: 30
Expand Down
2 changes: 1 addition & 1 deletion sample/.github/workflows/android_deploy_staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
build_and_deploy_android:
name: Build & Deploy Android
name: Android - Deploy Staging build to Firebase
runs-on: ubuntu-latest
environment: staging
timeout-minutes: 30
Expand Down
6 changes: 3 additions & 3 deletions sample/.github/workflows/ios_deploy_staging_to_firebase.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: ios-deploy-to-staging
name: iOS - Deploy Staging build to Firebase
on:
# Trigger the workflow on push action
push:
branches:
- develop

jobs:
build_and_upload_staging_app_to_firebase:
name: Build And Upload iOS Staging Application To Firebase
build_and_deploy_ios:
name: iOS - Deploy Staging build to Firebase
runs-on: macOS-latest
environment: staging
env:
Expand Down
6 changes: 3 additions & 3 deletions sample/.github/workflows/ios_deploy_to_app_store.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: ios-deploy-production-to-app-store
name: iOS - Deploy Production build to AppStore
on:
# Trigger the workflow on push action
push:
branches:
- main

jobs:
build_and_upload_to_app_store:
name: Build And Upload iOS Application Production To AppStore
build_and_deploy_ios:
name: iOS - Deploy Production build to AppStore
runs-on: macOS-latest
environment: production
timeout-minutes: 30
Expand Down
6 changes: 3 additions & 3 deletions sample/.github/workflows/ios_deploy_to_testflight.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: ios-deploy-production-to-testflight
name: iOS - Deploy Production build to TestFlight
on:
# Trigger the workflow on push action
push:
branches:
- main

jobs:
build_and_upload_to_testflight:
name: Build And Upload iOS Application Production To TestFlight
build_and_deploy_ios:
name: iOS - Deploy Production build to TestFlight
runs-on: macOS-latest
environment: production
timeout-minutes: 30
Expand Down
8 changes: 7 additions & 1 deletion sample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@
### Setup

- Create these `.env` files in the root directory according to the flavors and add the required
environment variables. The example environment variable is in `.env.sample`.
environment variables. The example file is `.env.sample`.

- Staging: `.env.staging`

- Production: `.env`

- To make the Android release build,

- put the `release.keystore` at the `android/config` folder,

- create the `signing.properties` file to provide keystore credentials in the `android` folder. The example file is `signing.properties.sample`.

### Run

- Run code generator for JSON models, DI dependencies, etc:
Expand Down
24 changes: 24 additions & 0 deletions sample/android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

# Keep BuildConfig for Flutter Config https://github.com/ByneappLLC/flutter_config/blob/master/doc/ANDROID.md#android-setup
-keep class co.nimblehq.flutter.template.BuildConfig { *; }
Loading

0 comments on commit cfff3e0

Please sign in to comment.