-
Notifications
You must be signed in to change notification settings - Fork 0
261 lines (257 loc) · 8.82 KB
/
release.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
253
254
255
256
257
258
259
260
261
on: workflow_dispatch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
name: release
permissions:
contents: read
env:
flutter_version: "3.10.x"
jobs:
calc-release-version:
name: calc-release-version
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v3
with:
# safety github token credential
persist-credentials: false
fetch-depth: 0
- name: override releaserc config
run: cat .releaserc-pubspec > .releaserc
- name: calculate release version
uses: actions/setup-node@v3
with:
node-version: 18
cache: "npm"
- run: npm ci
- run: npx semantic-release
env:
# only for read
GITHUB_TOKEN: ${{ secrets.CI_RELEASE_TOKEN }}
- name: version
run: cat pubspec.yaml | grep version
- name: upload pubspec with new version
uses: actions/upload-artifact@v3
with:
name: pubspec
path: pubspec.yaml
build-linux:
name: build-linux
runs-on: ubuntu-latest
needs: calc-release-version
steps:
- name: checkout code
uses: actions/checkout@v3
- name: download release pubspec
uses: actions/download-artifact@v3
with:
name: pubspec
- name: version
run: cat pubspec.yaml | grep version
- name: set up flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.flutter_version }}
channel: "stable"
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
- name: apt install build deps
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: zip ninja-build libgtk-3-dev
- name: flutter enable linux desktop target
run: flutter config --enable-linux-desktop
- name: flutter build linux
run: flutter build linux
- name: zip build linux
uses: thedoctor0/[email protected]
with:
type: zip
filename: linux-x64.zip
directory: build/linux/x64/release/bundle
- name: upload linux build artifact
uses: actions/upload-artifact@v3
with:
name: linux-x64
path: build/linux/x64/release/bundle/linux-x64.zip
build-windows:
name: build-windows
runs-on: windows-latest
needs: calc-release-version
steps:
- name: checkout code
uses: actions/checkout@v3
- name: download release pubspec
uses: actions/download-artifact@v3
with:
name: pubspec
- name: set up flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.flutter_version }}
channel: "stable"
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
- name: flutter enable windows desktop target
run: flutter config --enable-windows-desktop
- name: flutter build windows
run: flutter build windows
- name: zip build windows
uses: thedoctor0/[email protected]
with:
type: zip
filename: windows-x64.zip
directory: build/windows/runner/Release
- name: upload windows build artifact
uses: actions/upload-artifact@v3
with:
name: windows-x64
path: build/windows/runner/Release/windows-x64.zip
build-macos:
name: build-macos
runs-on: macos-latest
needs: calc-release-version
steps:
- name: checkout code
uses: actions/checkout@v3
- name: download release pubspec
uses: actions/download-artifact@v3
with:
name: pubspec
- name: set up dmg-packer
run: brew install create-dmg
- name: set up flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.flutter_version }}
channel: "stable"
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
- name: flutter enable macos desktop target
run: flutter config --enable-macos-desktop
- name: flutter build macos
run: flutter build macos --no-tree-shake-icons
- name: build macos dmg
run: create-dmg --volname "Pilot S3" --window-pos 200 120 --window-size 800 529 --app-drop-link 540 250 --hdiutil-quiet --app-drop-link 600 185 "pilot-s3.dmg" "build/macos/Build/Products/Release/pilot_s3.app/"
- name: upload macos build artifact
uses: actions/upload-artifact@v3
with:
name: macos-x64
path: pilot-s3.dmg
build-android:
name: build-android
runs-on: ubuntu-latest
needs: calc-release-version
steps:
- name: checkout code
uses: actions/checkout@v3
- name: download release pubspec
uses: actions/download-artifact@v3
with:
name: pubspec
- name: set up flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.flutter_version }}
channel: "stable"
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
- name: flutter build android
run: flutter build apk --no-tree-shake-icons
- name: move build android
run: mv build/app/outputs/flutter-apk/app-release.apk pilot-s3.apk
- name: upload android build artifact
uses: actions/upload-artifact@v3
with:
name: android-x64
path: pilot-s3.apk
build-web:
name: build-web
runs-on: ubuntu-latest
needs: calc-release-version
steps:
- name: checkout code
uses: actions/checkout@v3
- name: download release pubspec
uses: actions/download-artifact@v3
with:
name: pubspec
- name: set up flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.flutter_version }}
channel: "stable"
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
- name: flutter build web
run: flutter build web --no-tree-shake-icons
- name: upload to s3
id: s3
uses: shallwefootball/s3-upload-action@master
with:
aws_key_id: ${{ secrets.S3_ACCESS_KEY }}
aws_secret_access_key: ${{ secrets.S3_SECRET_KEY}}
aws_bucket: ${{ secrets.S3_BUCKET }}
endpoint: ${{ vars.S3_ENDPOINT }}
source_dir: build/web
destination_dir: ""
github-release:
name: github-release
runs-on: ubuntu-latest
needs:
[
calc-release-version,
build-linux,
build-windows,
build-macos,
build-android,
]
steps:
- name: checkout code
uses: actions/checkout@v3
with:
# safety github token credential
persist-credentials: false
fetch-depth: 0
- name: download release pubspec
uses: actions/download-artifact@v3
with:
name: pubspec
- name: version
run: cat pubspec.yaml | grep version
- name: download linux build artifact
uses: actions/download-artifact@v3
with:
name: linux-x64
- name: download windows build artifact
uses: actions/download-artifact@v3
with:
name: windows-x64
- name: download macos build artifact
uses: actions/download-artifact@v3
with:
name: macos-x64
- name: download android build artifact
uses: actions/download-artifact@v3
with:
name: android-x64
- name: release
uses: actions/setup-node@v3
with:
node-version: 18
cache: "npm"
- run: npm ci
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.CI_RELEASE_TOKEN }}
GIT_AUTHOR_NAME: 64mb-robot
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: 64mb-robot
GIT_COMMITTER_EMAIL: [email protected]