-
Notifications
You must be signed in to change notification settings - Fork 3
252 lines (205 loc) · 7.18 KB
/
build-deploy.yaml
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
name: Build and Deploy
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build_windows:
runs-on: windows-latest
environment: prod
steps:
- uses: actions/checkout@v3
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Install dependencies
run: flutter pub get
- name: Set up environment variables
run: |
touch .env
dart run build_runner build --delete-conflicting-outputs
- name: Build Windows
run: make build_windows
- name: Upload Windows artifact
uses: actions/upload-artifact@v4
with:
name: windows-build
path: build/windows/x64/runner/Release/
- run: |
cd build\windows\x64\runner\Release
Compress-Archive -Path * -DestinationPath WindowsRelease.zip
mkdir build
move WindowsRelease.zip build
shell: pwsh
- uses: ryand56/[email protected]
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: build/windows/x64/runner/Release/build
destination-dir: nightly/${{ github.run_id }}/windows
build_android:
runs-on: ubuntu-latest
environment: prod
steps:
- uses: actions/checkout@v3
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: Install dependencies
run: flutter pub get
- name: Set up environment variables
run: |
touch .env
dart run build_runner build --delete-conflicting-outputs
- name: Create key.properties file
run: |
echo "storePassword=${{ secrets.STORE_PASSWORD }}" >> android/key.properties
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties
echo "storeFile=key.jks" >> android/key.properties
- name: Decode and save keystore file
run: |
echo "${{ secrets.STORE_FILE_BASE64 }}" | base64 --decode > android/app/key.jks
- name: Build Android
run: make build_android
- name: Upload Android artifact
uses: actions/upload-artifact@v4
with:
name: android-build
path: build/app/outputs/flutter-apk/app-release.apk
- uses: ryand56/[email protected]
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: build/app/outputs/flutter-apk
destination-dir: nightly/${{ github.run_id }}/android
build_ipa:
runs-on: macos-latest
environment: prod
steps:
- uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
- name: Install dependencies
run: flutter pub get
- name: Set up environment variables
run: |
touch .env
dart run build_runner build --delete-conflicting-outputs
- name: Build iOS
run: flutter build ios --release --no-codesign
- name: Create and Pack IPA
run: |
cd build/ios/iphoneos
mkdir Payload
mv Runner.app Payload/
zip -r ../../../app.ipa Payload/
cd -
- name: Upload iOS artifact
uses: actions/upload-artifact@v4
with:
name: ios-build
path: app.ipa
- run: |
mkdir build_ipa
mv app.ipa build_ipa/
- uses: ryand56/[email protected]
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: build_ipa/
destination-dir: nightly/${{ github.run_id }}/ios
build_linux:
runs-on: ubuntu-latest
environment: prod
steps:
- uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev libmpv-dev mpv
- name: Install dependencies
run: flutter pub get
- name: Set up environment variables
run: |
touch .env
dart run build_runner build --delete-conflicting-outputs
- name: Build Linux
run: flutter build linux --release
- name: Upload Linux artifact
uses: actions/upload-artifact@v4
with:
name: linux-build
path: build/linux/x64/release/bundle
- run: |
cd build/linux/x64/release
zip -r LinuxRelease.zip ./bundle
mkdir build && mv LinuxRelease.zip build/
cd -
- uses: ryand56/[email protected]
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: build/linux/x64/release/build
destination-dir: nightly/${{ github.run_id }}/linux
build_macos:
runs-on: macos-latest
environment: prod
steps:
- uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.27.1'
channel: stable
- name: Install dependencies
run: flutter pub get
- name: Set up environment variables
run: |
touch .env
dart run build_runner build --delete-conflicting-outputs
- name: Build MacOS
run: flutter build macos --release
- name: Isolate the Build
run: mkdir build/macos/Build/Products/Release/AppRelease
- run: mv build/macos/Build/Products/Release/Madari.app build/macos/Build/Products/Release/AppRelease/
- name: Upload MacOS artifact
uses: actions/upload-artifact@v4
with:
name: macos-build
path: build/macos/Build/Products/Release/AppRelease
- run: |
cd build/macos/Build/Products/Release/AppRelease
zip -r AppRelease.zip .
mkdir mac_build
mv AppRelease.zip mac_build
cd -
- uses: ryand56/[email protected]
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: build/macos/Build/Products/Release/AppRelease/mac_build
destination-dir: nightly/${{ github.run_id }}/macos