ci(codemagic): add android app ci to build and publish automatically

This commit is contained in:
Amruth Pillai 2022-03-09 23:49:22 +01:00
parent fd752bfd70
commit 1e72efa7ac
No known key found for this signature in database
GPG Key ID: E3C57DF9B80855AD
2 changed files with 54 additions and 1 deletions

View File

@ -6,12 +6,14 @@ plugins {
android {
compileSdk 32
def appVersionCode = Integer.valueOf(System.env.BUILD_NUMBER ?: 0)
defaultConfig {
applicationId "me.rxresu.app"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
versionCode appVersionCode
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

51
codemagic.yaml Normal file
View File

@ -0,0 +1,51 @@
workflows:
android-workflow:
name: Android Workflow
working_directory: app
max_build_duration: 60
instance_type: mac_mini
environment:
node: latest
groups:
- keystore_credentials
- google_play
- other
vars:
FCI_KEYSTORE_PATH: /tmp/keystore.keystore
triggering:
events:
- push
- tag
- pull_request
branch_patterns:
- pattern: release
include: true
source: true
scripts:
- name: Set up local properties
script: echo "sdk.dir=$ANDROID_SDK_ROOT" > "$FCI_BUILD_DIR/local.properties"
- name: Set up key.properties file for code signing
script: |
echo $FCI_KEYSTORE | base64 --decode > $FCI_KEYSTORE_PATH
cat >> "$FCI_BUILD_DIR/android/key.properties" <<EOF
storePassword=$FCI_KEYSTORE_PASSWORD
keyPassword=$FCI_KEY_PASSWORD
keyAlias=$FCI_KEY_ALIAS
storeFile=$FCI_KEYSTORE_PATH
EOF
- name: Build Android App
script: ./gradlew bundleRelease
artifacts:
- app/build/outputs/**/**/*.aab
- app/build/outputs/**/**/*.apk
publishing:
google_play:
credentials: $GCLOUD_SERVICE_ACCOUNT_CREDENTIALS
track: production