Skip to content

Commit

Permalink
Create build-android.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
lapor86 authored Sep 13, 2024
1 parent a71822b commit 7fe020f
Showing 1 changed file with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Build Android

on:
push:
branches:
- main
paths:
- '.github/workflows/build-android.yml'
- 'packages/**'
- 'android/**'
- 'lib/**'
- 'assets/**'
- 'pubspec.yaml'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: recursive

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake libvulkan-dev
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.22.2'

- name: Decode Keystore File
env:
KEYSTORE: ${{ secrets.ANDROID_KEYSTORE }}
run: echo "$KEYSTORE" | base64 --decode > android/app/key.jks

- name: Create key.properties
run: |
echo "storeFile=key.jks" > android/key.properties
echo "storePassword=${{ secrets.ANDROID_STORE_PASSWORD }}" >> android/key.properties
echo "keyPassword=${{ secrets.ANDROID_KEY_PASSWORD }}" >> android/key.properties
echo "releasePassword=${{ secrets.ANDROID_KEY_PASSWORD }}" >> android/key.properties
echo "keyAlias=${{ secrets.ANDROID_KEY_ALIAS }}" >> android/key.properties
echo "releaseAlias=${{ secrets.ANDROID_KEY_ALIAS }}" >> android/key.properties
- name: Setup Flutter
run: |
flutter config --no-analytics
flutter pub get
- name: Build APK
run: |
flutter build apk -v --split-per-abi
- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: maid-android-apk
path: build/app/outputs/apk/release

- name: Build appbundle
run: |
flutter build appbundle
- name: Rename AAB
run: mv build/app/outputs/bundle/release/app-release.aab build/app/outputs/bundle/release/maid-android-bundle.aab

- name: Upload AAB
uses: actions/upload-artifact@v4
with:
name: maid-android-aab
path: build/app/outputs/bundle/release/maid-android-bundle.aab

0 comments on commit 7fe020f

Please sign in to comment.