-
Notifications
You must be signed in to change notification settings - Fork 2
109 lines (93 loc) · 3.54 KB
/
android.yml
File metadata and controls
109 lines (93 loc) · 3.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Flutter CI
on:
push:
branches: [ "dev" , "main" ]
pull_request:
branches: [ "dev" , "main" ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Cache pub dependencies
uses: actions/cache@v3
with:
path: |
${{ env.PUB_CACHE }}
~/.pub-cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install Firebase CLI
run: npm install -g firebase-tools
- name: Install FlutterFire CLI
run: dart pub global activate flutterfire_cli
- name: Install dependencies
run: flutter pub get
- name: Generate local code
run: flutter pub run build_runner build --delete-conflicting-outputs
- name: Generate Firebase Options
env:
FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
run: flutterfire configure --project=$FIREBASE_PROJECT_ID -y --platforms=android --out=lib/firebase_options.dart --token=$FIREBASE_TOKEN --android-package-name=com.pennypilot.moneyplus
- name: Configure Gradle memory
run: |
mkdir -p ~/.gradle
cat > ~/.gradle/gradle.properties << EOF
org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError
org.gradle.daemon=false
org.gradle.parallel=true
org.gradle.caching=true
android.useAndroidX=true
android.enableJetifier=true
EOF
- name: Decode keystore
env:
ANDROID_KEYSTORE_BASE64: ${{ secrets.SIGNING_KEY_BASE64 }}
run: echo "$ANDROID_KEYSTORE_BASE64" | base64 --decode > android/app/upload-keystore.jks
- name: Create key.properties
env:
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEY_ALIAS_PASSWORD: ${{ secrets.ANDROID_KEY_ALIAS_PASSWORD }}
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
run: |
cat <<EOF > android/key.properties
storePassword=$ANDROID_KEYSTORE_PASSWORD
keyPassword=$ANDROID_KEY_ALIAS_PASSWORD
keyAlias=$ANDROID_KEY_ALIAS
storeFile=upload-keystore.jks
EOF
- name: Build release APK
timeout-minutes: 30
run: flutter build apk --release --obfuscate --split-debug-info=build/app/outputs/symbols
- name: Distribute to Firebase
env:
FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }}
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
run: |
firebase appdistribution:distribute build/app/outputs/flutter-apk/app-release.apk \
--app "$FIREBASE_APP_ID" \
--groups "closed-beta-testers" \
--release-notes "Build from ${{ github.ref_name }} - Commit: ${{ github.sha }}"