2023-10-02 11:55:56 +01:00
|
|
|
workflows:
|
|
|
|
|
android-workflow:
|
|
|
|
|
name: Ionic Capacitor Android Workflow
|
|
|
|
|
max_build_duration: 120
|
|
|
|
|
environment:
|
|
|
|
|
android_signing:
|
2023-10-02 12:16:07 +01:00
|
|
|
- GabineteDigital
|
2023-10-02 11:55:56 +01:00
|
|
|
groups:
|
|
|
|
|
- google_play
|
|
|
|
|
vars:
|
|
|
|
|
PACKAGE_NAME: "com.gpr.gabinetedigital"
|
|
|
|
|
GOOGLE_PLAY_TRACK: alpha
|
|
|
|
|
node: latest
|
|
|
|
|
scripts:
|
|
|
|
|
- name: Install npm dependencies for Ionic Capacitor project
|
|
|
|
|
script: |
|
2023-10-02 12:20:14 +01:00
|
|
|
npm install --force
|
2023-10-02 11:55:56 +01:00
|
|
|
- name: Set up local.properties
|
|
|
|
|
script: |
|
|
|
|
|
echo "sdk.dir=$ANDROID_SDK_ROOT" > "$CM_BUILD_DIR/android/local.properties"
|
|
|
|
|
- name: Update dependencies and copy web assets to native project
|
|
|
|
|
script: |
|
|
|
|
|
# if you don't need to update native dependencies, use this:
|
|
|
|
|
# npx cap copy
|
|
|
|
|
#
|
|
|
|
|
# to update native dependencies, use this command:
|
2023-10-02 12:33:41 +01:00
|
|
|
ionic cap build android --prod
|
2023-10-02 11:55:56 +01:00
|
|
|
- name: Build Android release
|
|
|
|
|
script: |
|
|
|
|
|
LATEST_GOOGLE_PLAY_BUILD_NUMBER=$(google-play get-latest-build-number --package-name "$PACKAGE_NAME")
|
|
|
|
|
if [ -z $LATEST_GOOGLE_PLAY_BUILD_NUMBER ]; then
|
|
|
|
|
# fallback in case no build number was found from Google Play.
|
|
|
|
|
# Alternatively, you can `exit 1` to fail the build
|
|
|
|
|
# BUILD_NUMBER is a Codemagic built-in variable tracking the number
|
|
|
|
|
# of times this workflow has been built
|
|
|
|
|
UPDATED_BUILD_NUMBER=$BUILD_NUMBER
|
|
|
|
|
else
|
|
|
|
|
UPDATED_BUILD_NUMBER=$(($LATEST_GOOGLE_PLAY_BUILD_NUMBER + 1))
|
|
|
|
|
fi
|
|
|
|
|
cd android
|
|
|
|
|
./gradlew bundleRelease \
|
|
|
|
|
-PversionCode=$UPDATED_BUILD_NUMBER \
|
|
|
|
|
-PversionName=1.0.$UPDATED_BUILD_NUMBER
|
|
|
|
|
artifacts:
|
|
|
|
|
- android/app/build/outputs/**/*.apk
|
|
|
|
|
publishing:
|
|
|
|
|
email:
|
|
|
|
|
recipients:
|
|
|
|
|
- user_1@example.com
|
|
|
|
|
- user_2@example.com
|
|
|
|
|
notify:
|
|
|
|
|
success: true
|
|
|
|
|
failure: false
|