-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (113 loc) · 4.79 KB
/
android_build.yml
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: 🤖 Android Build
on:
workflow_call:
workflow_dispatch:
jobs:
android_build:
name: Build for Android
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run shared environment setup steps
uses: ./.github/actions/environment-setup
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
- name: Create Android keystore file
run: |
echo "${{ secrets.ANDROID_RELEASE_KEYSTORE }}" > android/release.keystore.asc
gpg -d --passphrase "${{secrets.ANDROID_RELEASE_KEYSTORE_ENCRYPTION_PASSPHRASE }}" --batch android/release.keystore.asc > android/release.keystore
- name: Create key.properties
run: |
echo "storeFile=release.keystore" >> android/key.properties
echo "storePassword=${{ secrets.ANDROID_RELEASE_KEYSTORE_PASSPHRASE }}" >> android/key.properties
echo "keyAlias=${{ secrets.ANDROID_KEY_ALIAS }}" >> android/key.properties
echo "keyPassword=${{ secrets.ANDROID_ALIAS_PW }}" >> android/key.properties
- name: Build App Bundle
run: >-
flutter build appbundle
--dart-define=IS_RELEASE=true
- name: Build APK
run: >-
flutter build apk
--dart-define=IS_RELEASE=true
- name: Upload AAB artifact
uses: actions/upload-artifact@v3
with:
name: aab
path: build/app/outputs/bundle/release/app-release.aab
- name: Upload APK artifact
uses: actions/upload-artifact@v3
with:
name: apk
path: build/app/outputs/flutter-apk/app-release.apk
# F-Droid Build
- name: Override dependencies in pubspec.yaml to be FLOSS
run: |
yq -y -i '.dependency_overrides.geolocator_android.git = {"url": "https://github.com/Zverik/flutter-geolocator.git", "ref": "floss", "path": "geolocator_android"}' pubspec.yaml
- name: Download pub dependencies
run: flutter pub get
- name: Build F-Droid APK
run: >-
flutter build apk
--dart-define=IS_RELEASE=true
# Required because F-Droid signs its apk with apksigner which produces a slightly different output than gradle signingConfig
# see: https://f-droid.org/docs/Reproducible_Builds/#reproducible-signatures
- name: Sign with apksigner
run: >-
$(find $ANDROID_SDK_ROOT/build-tools -name apksigner | sort -r | head -n 1) sign
--ks-key-alias ${{ secrets.ANDROID_KEY_ALIAS }}
--ks-pass pass:"${{ secrets.ANDROID_RELEASE_KEYSTORE_PASSPHRASE }}"
--ks key.jks
build/app/outputs/flutter-apk/app-release.apk
- name: Upload F-Droid APK artifact
uses: actions/upload-artifact@v3
with:
name: apk-fdroid
path: build/app/outputs/flutter-apk/app-release.apk
# android_build:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - run: |
# echo "${{ secrets.ANDROID_RELEASE_KEYSTORE }}" > android/release.keystore.asc
# gpg -d --passphrase "${{secrets.ANDROID_RELEASE_KEYSTORE_ENCRYPTION_PASSPHRASE }}" --batch android/release.keystore.asc > android/release.keystore
# - run: |
# echo "storeFile=release.keystore" >> android/key.properties
# echo "storePassword=${{ secrets.ANDROID_RELEASE_KEYSTORE_PASSPHRASE }}" >> android/key.properties
# echo "keyAlias=upload" >> android/key.properties
# echo "keyPassword=${{ secrets.ANDROID_ALIAS_PW }}" >> android/key.properties
# - name: Setup secrets
# uses: ./.github/actions/add-secrets
# with:
# mapaccesstoken: ${{ secrets.MAPACCESSTOKEN }}
# - uses: actions/setup-java@v3
# with:
# distribution: "zulu"
# java-version: "11"
# # - uses: nttld/setup-ndk@v1.0.6
# # id: setup-ndk
# # with:
# # ndk-version: r21e
# # add-to-path: false
# - name: Setup flutter
# uses: ./.github/actions/flutter-version
# # - run: flutter upgrade
# - run: flutter pub get
# - name: generate isar files
# run: flutter pub run build_runner build --delete-conflicting-outputs
# - run: flutter build apk --release --verbose
# # env:
# # ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
# - run: flutter build appbundle --release #--flavor aab
# # env:
# # ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
# - uses: actions/upload-artifact@v3
# with:
# name: android
# path: |
# build/app/outputs/flutter-apk/app-release.apk
# build/app/outputs/bundle/release/app-release.aab