-
Notifications
You must be signed in to change notification settings - Fork 6
308 lines (253 loc) · 9.5 KB
/
deploy_releases.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
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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
name: Deploy
on:
workflow_dispatch:
inputs:
build_android:
description: 'Build and Deploy Android'
required: true
type: boolean
default: true
jobs:
job-linux:
runs-on: ubuntu-latest
steps:
- uses: subosito/[email protected]
with:
channel: 'stable'
architecture: x64
- uses: actions/checkout@v2
with:
lfs: 'true'
- name: Update dependencies
run: |
flutter config --enable-linux-desktop
flutter doctor
sudo apt-get update -y
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev libblkid-dev tree
flutter doctor
flutter pub get
# This is to give an offset since builds before this repo were in the 100's
- name: Generate run number with offset
env:
NUM: ${{ github.run_number }}
run: |
echo "BUILD_NUMBER=$(($NUM + 200))" >> $GITHUB_ENV
- name: Generate app build name
shell: bash
run: echo "##[set-output name=name;]$(echo sweet_$BUILD_NUMBER)"
id: app_build
- name: Building ${{ steps.app_build.outputs.name }} Linux
run: flutter build linux --release --verbose
- name: 'Zipping build'
run: |
pushd build/linux/x64/release/bundle/
zip -r ${{ steps.app_build.outputs.name }}-linux.zip ./*
popd
mv build/linux/x64/release/bundle/${{ steps.app_build.outputs.name }}-linux.zip ./${{ steps.app_build.outputs.name }}-linux.zip
- name: 'Uploading artifact'
uses: actions/[email protected]
with:
name: ${{ steps.app_build.outputs.name }}-linux
path: ${{ steps.app_build.outputs.name }}-linux.zip
retention-days: 5
# WINDOWS
job-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
lfs: 'true'
- uses: subosito/[email protected]
with:
channel: 'stable'
architecture: x64
- name: Update dependencies
run: |
flutter config --enable-windows-desktop
flutter pub get
# This is to give an offset since builds before this repo were in the 100's
- name: Generate run number with offset
shell: bash
env:
NUM: ${{ github.run_number }}
run: |
echo "BUILD_NUMBER=$(($NUM + 200))" >> $GITHUB_ENV
- name: Generate app build name
shell: bash
run: echo "##[set-output name=name;]$(echo sweet_$BUILD_NUMBER)"
id: app_build
- name: Update Windows build number
shell: bash
run: |
VERSION_FROM_PUBSPEC=$(sed -n -e '/version: / s///p' pubspec.yaml | tr -d '\r\n')
VERSION=$(echo -n $VERSION_FROM_PUBSPEC | sed -E -e "s/((([0-9])+\.([0-9])+\.([0-9])+)\+(([0-9])+))/\2+$BUILD_NUMBER/")
echo "Setting windows version to $VERSION"
sed -i -E -e "s/((([0-9])+\.([0-9])+\.([0-9])+(([\+])([0-9])+)?))/$VERSION/" windows/runner/Runner.rc
- name: Building ${{ steps.app_build.outputs.name }} Windows
run: flutter build windows --release
- name: 'Zipping build'
uses: vimtor/action-zip@v1
with:
dest: ${{ steps.app_build.outputs.name }}-windows.zip
files: build/windows/x64/runner/Release
- name: 'Uploading artifact'
uses: actions/[email protected]
with:
name: ${{ steps.app_build.outputs.name }}-windows
path: ${{ steps.app_build.outputs.name }}-windows.zip
retention-days: 5
job-apple:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
lfs: 'true'
- uses: subosito/[email protected]
with:
channel: 'stable'
architecture: x64
- name: Update dependencies
run: |
flutter config --enable-macos-desktop
flutter pub get
# This is to give an offset since builds before this repo were in the 100's
- name: Generate run number with offset
env:
NUM: ${{ github.run_number }}
run: |
echo "BUILD_NUMBER=$(($NUM + 200))" >> $GITHUB_ENV
- name: Generate app build name
shell: bash
run: echo "##[set-output name=name;]$(echo sweet_$BUILD_NUMBER)"
id: app_build
# - name: Building ${{ steps.app_build.outputs.name }} iOS
# run: flutter build ios --build-number $BUILD_NUMBER --release --no-codesign --config-only
# - name: Setup Ruby
# uses: ruby/[email protected]
# with:
# bundler-cache: true
# - name: Build and upload to TestFlight
# run: |
# bundle install
# bundle exec fastlane ios beta
# env:
# SWEET_MATCH_ACCESS_TOKEN: ${{ secrets.SWEET_MATCH_ACCESS_TOKEN }}
# MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
# FASTLANE_USER: ${{ secrets.FASTLANE_APPLE_ID }}
# FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }}
# FASTLANE_APPLE_ID: ${{ secrets.FASTLANE_APPLE_ID }}
# FASTLANE_ITC_TEAM_ID: ${{ secrets.FASTLANE_ITC_TEAM_ID }}
# FASTLANE_TEAM_ID: ${{ secrets.FASTLANE_TEAM_ID }}
- name: Building ${{ steps.app_build.outputs.name }} MacOS
run: flutter build macos --build-number $BUILD_NUMBER --release
- name: 'Zipping build'
run: |
pushd build/macos/Build/Products/Release/
zip -r ${{ steps.app_build.outputs.name }}-macos.zip SWEET.app
popd
mv build/macos/Build/Products/Release/${{ steps.app_build.outputs.name }}-macos.zip ./${{ steps.app_build.outputs.name }}-macos.zip
- name: 'Uploading artifact'
uses: actions/[email protected]
with:
name: ${{ steps.app_build.outputs.name }}-macos
path: ${{ steps.app_build.outputs.name }}-macos.zip
retention-days: 5
job-android:
runs-on: ubuntu-latest
if: ${{ inputs.build_android }}
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
steps:
- uses: actions/checkout@v2
with:
lfs: 'true'
- name: Decode Upload keystore
working-directory: ./android
run: |
echo "${{ secrets.UPLOAD_KEYSTORE }}" > key.jks.asc
gpg -d --passphrase ${{ secrets.UPLOAD_KEYSTORE_PASSPHRASE }} --batch key.jks.asc > key.jks
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: subosito/[email protected]
with:
channel: 'stable'
architecture: x64
- name: Update dependencies
run: flutter pub get
# This is to give an offset since builds before this repo were in the 100's
- name: Generate run number with offset
env:
NUM: ${{ github.run_number }}
run: |
echo "BUILD_NUMBER=$(($NUM + 200))" >> $GITHUB_ENV
- name: Generate app build name
shell: bash
run: echo "##[set-output name=name;]$(echo sweet_$BUILD_NUMBER)"
id: app_build
- name: Building ${{ steps.app_build.outputs.name }}.aab
run: flutter build appbundle --build-number $BUILD_NUMBER --release
- name: Setup Ruby
uses: ruby/[email protected]
with:
bundler-cache: true
- name: Upload to Play Store
run: |
bundle install --jobs 4 --retry 3
bundle exec fastlane android upload_playstore
env:
SWEET_JSON_KEY_DATA: ${{ secrets.SWEET_JSON_KEY_DATA }}
AAB_PATH: build/app/outputs/bundle/release/app-release.aab
upload-release-s3:
needs: [job-linux, job-apple, job-windows]
runs-on: ubuntu-latest
steps:
# This is to give an offset since builds before this repo were in the 100's
- name: Generate run number with offset
env:
NUM: ${{ github.run_number }}
run: |
echo "BUILD_NUMBER=$(($NUM + 200))" >> $GITHUB_ENV
- name: Generate app build name
shell: bash
run: echo "##[set-output name=name;]$(echo sweet_$BUILD_NUMBER)"
id: app_build
- name: 'Download Linux artifact'
uses: actions/[email protected]
with:
name: ${{ steps.app_build.outputs.name }}-linux
- name: 'Download MacOS artifact'
uses: actions/[email protected]
with:
name: ${{ steps.app_build.outputs.name }}-macos
- name: 'Download Windows artifact'
uses: actions/[email protected]
with:
name: ${{ steps.app_build.outputs.name }}-windows
- name: Upload Windows releases to S3
uses: a-sync/[email protected]
env:
AWS_REGION: 'us-west-1'
S3_BUCKET: ${{ secrets.AWS_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
FILE: './${{ steps.app_build.outputs.name }}-windows.zip'
S3_KEY: '/releases/${{ steps.app_build.outputs.name }}-windows.zip'
- name: Upload MacOS releases to S3
uses: a-sync/[email protected]
env:
AWS_REGION: 'us-west-1'
S3_BUCKET: ${{ secrets.AWS_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
FILE: './${{ steps.app_build.outputs.name }}-macos.zip'
S3_KEY: '/releases/${{ steps.app_build.outputs.name }}-macos.zip'
- name: Upload Linux releases to S3
uses: a-sync/[email protected]
env:
AWS_REGION: 'us-west-1'
S3_BUCKET: ${{ secrets.AWS_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
FILE: './${{ steps.app_build.outputs.name }}-linux.zip'
S3_KEY: '/releases/${{ steps.app_build.outputs.name }}-linux.zip'