Skip to content

Commit

Permalink
Support 2 build flavors: Github and GooglePlay. Build and upload both…
Browse files Browse the repository at this point in the history
… when building via CI.
  • Loading branch information
tuancoltech committed Dec 29, 2024
1 parent 5eda729 commit 806d9e4
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 19 deletions.
39 changes: 27 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ on:
branches: [ main ]

env:
ACRA_LOGIN: ${{ secrets.ACRARIUM_BASIC_AUTH_LOGIN }}
ACRA_PASS: ${{ secrets.ACRARIUM_BASIC_AUTH_PASSWORD }}
ACRA_URI: ${{ secrets.ACRARIUM_URI }}
BRANCH_NAME: ${{ github.ref_name }}


Expand Down Expand Up @@ -59,23 +56,41 @@ jobs:
- name: Build release APK
run: ./gradlew assembleRelease

- name: Upload release arm64-v8a APK
- name: Upload release Github arm64-v8a APK
uses: actions/upload-artifact@v4
with:
name: release-arm64-v8a-apk
path: ./app/build/outputs/apk/release/app-arm64-v8a-release.apk
name: release-arm64-v8a-apk-github
path: ./app/build/outputs/apk/github/release/app-github-arm64-v8a-release.apk

- name: Upload release armeabi-v7a APK
- name: Upload release Github armeabi-v7a APK
uses: actions/upload-artifact@v4
with:
name: release-armeabi-v7a-apk
path: ./app/build/outputs/apk/release/app-armeabi-v7a-release.apk
name: release-armeabi-v7a-apk-github
path: ./app/build/outputs/apk/github/release/app-github-armeabi-v7a-release.apk

- name: Upload release universal APK
- name: Upload release Github universal APK
uses: actions/upload-artifact@v4
with:
name: release-universal-apk
path: ./app/build/outputs/apk/release/app-universal-release.apk
name: release-universal-apk-github
path: ./app/build/outputs/apk/github/release/app-github-universal-release.apk

- name: Upload release GooglePlay arm64-v8a APK
uses: actions/upload-artifact@v4
with:
name: release-arm64-v8a-apk-googleplay
path: ./app/build/outputs/apk/googleplay/release/app-googleplay-arm64-v8a-release.apk

- name: Upload release GooglePlay armeabi-v7a APK
uses: actions/upload-artifact@v4
with:
name: release-armeabi-v7a-apk-googleplay
path: ./app/build/outputs/apk/googleplay/release/app-googleplay-armeabi-v7a-release.apk

- name: Upload release GooglePlay universal APK
uses: actions/upload-artifact@v4
with:
name: release-universal-apk-googleplay
path: ./app/build/outputs/apk/googleplay/release/app-googleplay-universal-release.apk

lint:
needs: build
Expand Down
21 changes: 14 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ android {
versionCode 1
versionName "1.0"

def login = System.getenv("ACRA_LOGIN") ?: ""
def password = System.getenv("ACRA_PASS") ?: ""
def uri = System.getenv("ACRA_URI") ?: ""
buildConfigField "String", "ACRA_LOGIN", "\"$login\""
buildConfigField "String", "ACRA_PASS", "\"$password\""
buildConfigField "String", "ACRA_URI", "\"$uri\""

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
Expand Down Expand Up @@ -58,6 +51,20 @@ android {
]
}
}

flavorDimensions = ["publishTarget"]
productFlavors {
github {
dimension "publishTarget"
buildConfigField "boolean", "GOOGLE_PLAY_BUILD", "false"
}

googleplay {
dimension "publishTarget"
buildConfigField "boolean", "GOOGLE_PLAY_BUILD", "true"
}
}

splits {
abi {
enable true
Expand Down

0 comments on commit 806d9e4

Please sign in to comment.