Last active
August 8, 2024 09:30
-
-
Save empeje/9ebad8499a9f251cac14124db90e2f33 to your computer and use it in GitHub Desktop.
Firebase App Distribution Android - GitLab CI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .android_build: | |
| image: openjdk:8-jdk | |
| stage: build # kind of job | |
| variables: | |
| ANDROID_COMPILE_SDK: "29" | |
| ANDROID_BUILD_TOOLS: "29.0.3" | |
| ANDROID_SDK_TOOLS: "4333796" | |
| FLUTTER_VERSION: "https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_1.22.6-stable.tar.xz" | |
| before_script: | |
| # Install Firebase | |
| - curl -L https://firebase.tools/bin/linux/latest -o firebase | |
| - chmod +x firebase | |
| - mv firebase /usr/local/bin/ | |
| # Install Android | |
| - apt-get --quiet update --yes | |
| - apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1 | |
| - wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip | |
| - unzip -d android-sdk-linux android-sdk.zip | |
| - echo y | android-sdk-linux/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null | |
| - echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" >/dev/null | |
| - echo y | android-sdk-linux/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null | |
| - export ANDROID_HOME=$PWD/android-sdk-linux | |
| - export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/ | |
| ## temporarily disable checking for EPIPE error and use yes to accept all licenses | |
| - set +o pipefail | |
| - yes | android-sdk-linux/tools/bin/sdkmanager --licenses | |
| - set -o pipefail | |
| # Install Flutter | |
| - wget --output-document=flutter-sdk.tar.xz $FLUTTER_VERSION | |
| - tar -xf flutter-sdk.tar.xz | |
| - export PATH=$PATH:$PWD/flutter/bin | |
| - flutter precache | |
| - flutter packages get | |
| - flutter clean | |
| stages: | |
| - test # All jobs related for testing such as Unit Test | |
| - build # All jobs related for building app for iOS and Android | |
| #### | |
| #### flutter debug | |
| #### | |
| flutter_build_debug: #Job name | |
| extends: .android_build | |
| retry: 2 | |
| script: | |
| - flutter build apk --flavor dev | |
| artifacts: | |
| paths: | |
| - build/app/outputs/flutter-apk/app-dev-release.apk | |
| #### | |
| #### flutter release | |
| #### | |
| flutter_build_release: #Job name | |
| extends: .android_build | |
| retry: 2 | |
| script: | |
| - flutter build apk --release --flavor prod | |
| - flutter build appbundle --release --flavor prod | |
| - ./bin/app_distribution.sh | |
| artifacts: | |
| paths: | |
| - build/app/outputs/flutter-apk/app-prod-release.apk | |
| - build/app/outputs/bundle/prodRelease/app-prod-release.aab |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| RELEASE_NOTE=$(git log -1 --oneline --format=%s) | |
| firebase appdistribution:distribute build/app/outputs/flutter-apk/app-prod-release.apk \ | |
| --token "$FIREBASE_TOKEN" \ | |
| --app "$APP_ID" \ | |
| --release-notes "$RELEASE_NOTE" --testers-file testers.txt |
hendisantika
commented
Aug 5, 2024
Author
That's expected, you need to figure out how to use the apk in alpine and beyond the guide I have provided in the YuoTube video. I usually like to help, but I'm a bit time poor right now, so I suggest you to learn how to use it by yourself for now.
Ok Thanks @empeje
I created new one with this:
image: "ghcr.io/cirruslabs/flutter:3.22.3"
stages:
- build
- deploy
variables:
FIREBASE_CLI_VERSION: "11.5.0"
GRADLE_USER_HOME: "/builds/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/.gradle"
cache:
key: "${CI_JOB_NAME}"
paths:
- .gradle/wrapper
- .gradle/caches
before_script:
- flutter doctor
- flutter pub get
build:
stage: build
script:
- flutter build apk --release
- ls -la build/app/outputs/flutter-apk/
artifacts:
paths:
- build/app/outputs/flutter-apk/app-release.apk
deploy:
stage: deploy
dependencies:
- build
only:
- main
script:
- curl -sL https://firebase.tools | bash
- firebase appdistribution:distribute build/app/outputs/flutter-apk/app-release.apk --app $FIREBASE_APP_ID --token $FIREBASE_TOKEN --groups "testers" --release-notes "New version of ANA ONLINE is available"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment