Build Android #97
This file contains 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
name: Build Android | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push events but only for the "main" branch | |
# push: | |
# branches: [ "main" ] | |
# pull_request: | |
# branches: [ "main" ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build-android: | |
name: Build Android | |
runs-on: macOS-latest | |
steps: | |
- name: ποΈ Setup c-breez repository | |
uses: actions/checkout@v4 | |
with: | |
path: 'cbreez' | |
- name: ποΈ Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: ποΈ Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
cache: true | |
- name: ποΈ Android cache | |
id: android-cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.android/debug.keystore | |
key: debug.keystore | |
- name: ποΈ Copy Firebase configuration file | |
working-directory: cbreez | |
env: | |
GOOGLE_SERVICES: ${{secrets.GOOGLE_SERVICES}} | |
run: echo "$GOOGLE_SERVICES" > android/app/google-services.json | |
- name: ποΈ Setup breez-sdk repository | |
uses: actions/checkout@v4 | |
with: | |
repository: 'breez/breez-sdk' | |
ssh-key: ${{secrets.REPO_SSH_KEY}} | |
path: 'breez-sdk' | |
- name: Install Breez SDK dependencies | |
run: | | |
cargo install [email protected] | |
brew install protobuf | |
cd breez-sdk/libs/sdk-flutter | |
make init | |
cd ../sdk-core | |
make init | |
- name: Build Breez SDK | |
env: | |
SSH_PRIVATE_KEY: ${{secrets.REPO_SSH_KEY}} | |
run: | | |
mkdir -p ~/.ssh | |
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa | |
sudo chmod 600 ~/.ssh/id_rsa | |
ssh-add ~/.ssh/id_rsa | |
cd breez-sdk/libs/sdk-flutter | |
make android | |
- name: Populate Flutter tool's cache of binary artifacts. | |
run: flutter precache | |
- name: π¦ Install Flutter dependencies | |
run: flutter pub get | |
- name: Perform static analysis | |
working-directory: cbreez | |
run: dart analyze --fatal-infos | |
- name: Run tests | |
working-directory: cbreez | |
run: flutter test | |
- name: Setup compile-time variables | |
env: | |
CONFIG_FILE: ${{secrets.CONFIG_FILE}} | |
run: echo "$CONFIG_FILE" > ./cbreez/config.json | |
- name: π Build Release apk | |
working-directory: cbreez | |
run: flutter build apk --release --split-debug-info=./obsfucated/debug --obfuscate --config-only --no-pub --split-per-abi --dart-define-from-file=config.json | |
- name: ποΈ Compress build folder (APK) | |
uses: TheDoctor0/zip-release@master | |
with: | |
filename: build.zip | |
directory: cbreez/build/app/outputs/flutter-apk | |
type: zip | |
- name: π€ Upload asset (APK) | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
asset_name: Android-APK.zip | |
file: cbreez/build/app/outputs/flutter-apk/build.zip | |
overwrite: true | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: π€ Upload artifact (APK) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Android-APK | |
path: cbreez/build/app/outputs/flutter-apk/app-*.apk |