-
-
Notifications
You must be signed in to change notification settings - Fork 31
180 lines (155 loc) · 5.81 KB
/
release.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: Build
on:
release:
types: [created]
push:
branches: [master]
env:
JAVA_VERSION: "17.x"
FLUTTER_CHANNEL: "stable"
PROPERTIES_PATH: "./android/key.properties"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Setup Java environment in order to build the Android app.
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: ${{env.JAVA_VERSION}}
cache: 'gradle'
# Setup the flutter environment.
- uses: subosito/flutter-action@v2
with:
channel: ${{env.FLUTTER_CHANNEL}}
cache: true
# Generate keystore
- uses: timheuer/[email protected]
id: android_keystore
with:
fileName: upload-keystore.jks
encodedString: ${{ secrets.KEYSTORE_BASE64 }}
# Create key.properties
- run: |
echo "storeFile=${{ steps.android_keystore.outputs.filePath }}" > ${{env.PROPERTIES_PATH}}
echo "storePassword=${{ secrets.STORE_PASSWORD }}" >> ${{env.PROPERTIES_PATH}}
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> ${{env.PROPERTIES_PATH}}
echo "keyAlias=upload" >> ${{env.PROPERTIES_PATH}}
# Set build number
- run: |
sed -i 's/^\(version: [0-9\.]\{1,\}\(-[a-z]\{1,\}\)\{0,1\}\)$/\1+${{ github.run_number }}/m' pubspec.yaml
# No dart analytics.
- run: dart --disable-analytics
# No flutter analytics.
- run: flutter config --no-analytics
# Get flutter dependencies.
- run: flutter pub get
# Check for any formatting issues in the code.
- run: dart format --set-exit-if-changed .
# Statically analyze the Dart code for any errors.
- run: dart analyze .
# Run widget tests for our flutter project.
# - run: flutter test
# Build apk.
- run: flutter build apk --obfuscate --split-debug-info=build/app/outputs/symbols/apk --release --split-per-abi
# Build aab
- run: flutter build appbundle --obfuscate --split-debug-info=build/app/outputs/symbols/aab --release
# Zip symbols
- uses: montudor/action-zip@v1
- run: zip -qq -r aab-debug-symbols.zip *
working-directory: build/app/intermediates/merged_native_libs/release/out/lib/
# Upload generated apk to the artifacts.
- uses: actions/upload-artifact@v3
with:
name: app-arm64-v8a-release.apk
path: build/app/outputs/apk/release/app-arm64-v8a-release.apk
- uses: actions/upload-artifact@v3
with:
name: app-armeabi-v7a-release.apk
path: build/app/outputs/apk/release/app-armeabi-v7a-release.apk
- uses: actions/upload-artifact@v3
with:
name: app-x86_64-release.apk
path: build/app/outputs/flutter-apk/app-x86_64-release.apk
- uses: actions/upload-artifact@v3
with:
name: app-release.aab
path: build/app/outputs/bundle/release/app-release.aab
- uses: actions/upload-artifact@v3
with:
name: aab-debug-symbols.zip
path: build/app/intermediates/merged_native_libs/release/out/lib/aab-debug-symbols.zip
- uses: actions/upload-artifact@v3
with:
name: mapping.txt
path: build/app/outputs/mapping/release/mapping.txt
upload-to-github:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/download-artifact@v3
with:
name: app-arm64-v8a-release.apk
path: ./artifacts
- uses: actions/download-artifact@v3
with:
name: app-armeabi-v7a-release.apk
path: ./artifacts
- uses: actions/download-artifact@v3
with:
name: app-x86_64-release.apk
path: ./artifacts
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
./artifacts/app-arm64-v8a-release.apk
./artifacts/app-armeabi-v7a-release.apk
./artifacts/app-x86_64-release.apk
deploy:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/download-artifact@v3
with:
name: app-release.aab
path: ./artifacts
- uses: actions/download-artifact@v3
with:
name: aab-debug-symbols.zip
path: ./artifacts
- uses: actions/download-artifact@v3
with:
name: mapping.txt
path: ./artifacts
- uses: r0adkll/upload-google-play@v1
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
with:
serviceAccountJsonPlainText: ${{ secrets.PLAYSTORE_ACCOUNT_KEY }}
packageName: com.dreautall.waterflyiii
releaseFiles: ./artifacts/app-release.aab
debugSymbols: ./artifacts/aab-debug-symbols.zip
mappingFile: ./artifacts/mapping.txt
track: internal
status: completed
- uses: r0adkll/upload-google-play@v1
if: ${{ startsWith(github.ref, 'refs/tags/') && github.event.release.prerelease }}
with:
serviceAccountJsonPlainText: ${{ secrets.PLAYSTORE_ACCOUNT_KEY }}
packageName: com.dreautall.waterflyiii
releaseFiles: ./artifacts/app-release.aab
debugSymbols: ./artifacts/aab-debug-symbols.zip
mappingFile: ./artifacts/mapping.txt
track: alpha
status: completed
- uses: r0adkll/upload-google-play@v1
if: ${{ startsWith(github.ref, 'refs/tags/') && !github.event.release.prerelease }}
with:
serviceAccountJsonPlainText: ${{ secrets.PLAYSTORE_ACCOUNT_KEY }}
packageName: com.dreautall.waterflyiii
releaseFiles: ./artifacts/app-release.aab
debugSymbols: ./artifacts/aab-debug-symbols.zip
mappingFile: ./artifacts/mapping.txt
track: beta
status: completed