-
-
Notifications
You must be signed in to change notification settings - Fork 147
151 lines (128 loc) · 4.19 KB
/
android-play-store.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
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Build for Play Store
on:
# Enable manual run
workflow_dispatch:
push:
tags:
- '**'
branches:
- '**'
paths:
- .github/workflows/android-play-store.yml
jobs:
build-aab:
name: Build AAB for the Play Store
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Remove unneeded files
run: |
rm -rf appimage
rm -rf assets_raw
rm -rf flatpak
rm -rf installers
rm -rf integration_test
rm -rf ios
rm -rf linux
rm -rf macos
rm -rf metadata
rm -rf snap
rm -rf submodules
rm -rf test
rm -rf windows
- name: Setup cache
uses: actions/cache@v4
with:
path: |
build
key: ${{ runner.OS }}-saber-${{ hashFiles('**/pubspec.lock') }}-${{ hashFiles('**/*.dart') }}
restore-keys: |
${{ runner.OS }}-saber-
- name: Remove signingConfig
run: ./patches/remove_signing_android.sh
- name: Remove REQUEST_INSTALL_PACKAGES permission
run: ./patches/remove_request_install_packages_permission.sh
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:'
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '17'
- run: flutter pub get
- name: Build aab
run: |
flutter build appbundle \
--dart-define=FLAVOR="Google Play" \
--dart-define=APP_STORE="Google Play" \
--dart-define=UPDATE_CHECK="false" \
--dart-define=DIRTY="false"
- name: Move unsigned apk
run: |
mkdir -p output
mv build/app/outputs/bundle/release/app-release.aab output/Saber.aab
- name: Sign aab
uses: ilharp/sign-android-release@v1
id: sign_app
with:
releaseDir: output
signingKey: ${{ secrets.SIGNING_KEY }}
keyAlias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
- name: Rename signed apk
run: mv ${{ steps.sign_app.outputs.signedFile }} output/Saber.aab
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: Saber-Android-PlayStore
path: output/Saber.aab
upload-to-play-store:
name: Upload to Play Store
runs-on: ubuntu-latest
needs: build-aab
timeout-minutes: 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: Saber-Android-PlayStore
path: output
- name: Prepare whatsnew directory from metadata/*/changelogs
working-directory: ${{ github.workspace }}
run: |
# display changelogs for debugging
find metadata -name '*.txt'
mkdir -p whatsnew
# get current version code from lib/data/version.dart
VERSION_CODE=$(grep -oP '(?<=buildNumber = )\d+' lib/data/version.dart)
# copy changelogs of each language to whatsnew
for dir in metadata/*/changelogs; do
# get language code from directory name
# e.g. metadata/en-US/changelogs -> en-US
lang=${dir#metadata/}
lang=${lang%/changelogs}
# get original changelog file
original="$dir/$VERSION_CODE.txt"
if [ -f "$original" ]; then
# copy changelog file to whatsnew
cp "$original" "whatsnew/whatsnew-${lang}"
fi
done
- name: Upload to Play Store
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.PLAY_STORE_JSON }}
packageName: com.adilhanney.saber
releaseFiles: output/Saber.aab
track: production
status: completed
whatsNewDirectory: whatsnew