-
Notifications
You must be signed in to change notification settings - Fork 1
112 lines (96 loc) · 3.25 KB
/
Copy pathandroid-release.yml
File metadata and controls
112 lines (96 loc) · 3.25 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
110
111
112
name: Android Build
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to build from'
required: true
type: string
default: 'main'
build_type:
description: 'Build type'
required: true
type: choice
options:
- release
- debug
push:
branches:
- main
- develop
permissions:
contents: read
jobs:
build-android-prod:
runs-on: ubuntu-latest
if: (github.ref == 'refs/heads/main' && github.event_name == 'push') || (github.event_name == 'workflow_dispatch' && github.inputs.build_type == 'release')
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ (github.event_name == 'workflow_dispatch' && github.inputs.branch) || github.ref }}
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
- name: Flutter pub get
run: flutter pub get
- name: Prepare Android signing (optional)
env:
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
ANDROID_STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }}
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
run: |
if [ -n "$ANDROID_KEYSTORE_BASE64" ]; then
echo "$ANDROID_KEYSTORE_BASE64" | base64 --decode > android/app/release-keystore.jks
cat <<EOF > android/key.properties
storeFile=app/release-keystore.jks
storePassword=$ANDROID_STORE_PASSWORD
keyAlias=$ANDROID_KEY_ALIAS
keyPassword=$ANDROID_KEY_PASSWORD
EOF
else
echo "No Android signing secrets found; using fallback signing config."
fi
- name: Build release APK
run: flutter build apk --release
- name: Upload APK and AAB artifacts
uses: actions/upload-artifact@v4
with:
name: android-prod-${{ github.sha }}
path: |
build/app/outputs/flutter-apk/app-release.apk
if-no-files-found: error
build-android-dev:
runs-on: ubuntu-latest
if: (github.ref == 'refs/heads/develop' && github.event_name == 'push') || (github.event_name == 'workflow_dispatch' && github.inputs.build_type == 'debug')
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ (github.event_name == 'workflow_dispatch' && github.inputs.branch) || github.ref }}
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
- name: Flutter pub get
run: flutter pub get
- name: Build debug APK
run: flutter build apk --debug
- name: Upload debug APK artifact
uses: actions/upload-artifact@v4
with:
name: android-dev-${{ github.sha }}
path: build/app/outputs/flutter-apk/app-debug.apk
if-no-files-found: error