-
-
Notifications
You must be signed in to change notification settings - Fork 31
164 lines (145 loc) · 5.43 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
name: Build
on:
release:
types:
- created
push:
branches:
- develop
env:
PROPERTIES_PATH: "./android/key.properties"
jobs:
check:
uses: ./.github/workflows/commit.yml
name: codecheck
build:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, '[skip-build]') }}
needs: [check]
steps:
- uses: actions/checkout@v4
# Call setup_env action to setup workspace
- uses: ./.github/actions/setup_env
with:
java-version: ${{ vars.JAVA_VERSION }}
flutter-channel: ${{ vars.FLUTTER_CHANNEL }}
# 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
# 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@v4
with:
name: app-arm64-v8a-release.apk
path: build/app/outputs/apk/release/app-arm64-v8a-release.apk
- uses: actions/upload-artifact@v4
with:
name: app-armeabi-v7a-release.apk
path: build/app/outputs/apk/release/app-armeabi-v7a-release.apk
- uses: actions/upload-artifact@v4
with:
name: app-x86_64-release.apk
path: build/app/outputs/flutter-apk/app-x86_64-release.apk
- uses: actions/upload-artifact@v4
with:
name: app-release.aab
path: build/app/outputs/bundle/release/app-release.aab
- uses: actions/upload-artifact@v4
with:
name: aab-debug-symbols.zip
path: build/app/intermediates/merged_native_libs/release/out/lib/aab-debug-symbols.zip
- uses: actions/upload-artifact@v4
with:
name: mapping.txt
path: build/app/outputs/mapping/release/mapping.txt
upload-to-github:
runs-on: ubuntu-latest
needs: [build]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
with:
name: app-arm64-v8a-release.apk
path: ./artifacts
- uses: actions/download-artifact@v4
with:
name: app-armeabi-v7a-release.apk
path: ./artifacts
- uses: actions/download-artifact@v4
with:
name: app-x86_64-release.apk
path: ./artifacts
- uses: softprops/action-gh-release@v1
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@v4
with:
name: app-release.aab
path: ./artifacts
- uses: actions/download-artifact@v4
with:
name: aab-debug-symbols.zip
path: ./artifacts
- uses: actions/download-artifact@v4
with:
name: mapping.txt
path: ./artifacts
# not a release --> push to internal
- 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
# prerelease --> push to beta
- 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
# release --> push to production
- 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: production
status: completed