-
Notifications
You must be signed in to change notification settings - Fork 16
248 lines (243 loc) · 7.73 KB
/
release_build.yml
File metadata and controls
248 lines (243 loc) · 7.73 KB
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
name: Release build
on:
push:
tags:
- 'v*'
env:
CI_FLUTTER_VERSION: '3.38.3' # Do NOT remove or rename the variable otherwise will break FDroid workflows.
CI_RUST_VERSION: '1.83.0' # Keep a same rust version on all compile targets.
jobs:
release:
name: Create release
runs-on: ubuntu-latest
permissions:
contents: write
env:
PRERELEASE: ${{ contains(github.ref_name, '-') }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
prerelease: ${{ env.PRERELEASE }}
- name: Create release
uses: ncipollo/release-action@v1
with:
prerelease: ${{ env.PRERELEASE }}
allowUpdates: true
omitPrereleaseDuringUpdate: true
body: '${{ steps.extract-release-notes.outputs.release_notes }}'
build-linux:
name: Build Linux
needs: [ release ]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{env.CI_FLUTTER_VERSION}}
cache: true
- run: |
sudo apt update -y
sudo apt install -y ninja-build libgtk-3-dev sqlite3 libsqlite3-dev
- name: Precompile
run: |
git submodule update --init --recursive --force
flutter pub get
dart ./Makefile.dart
- name: Build Linux
run: flutter build linux --release
- name: Pre Packing
run: |
pushd build/linux/x64/release/
mv bundle tsdm_client
popd
- name: Pack Linux tarball
uses: thedoctor0/zip-release@master
with:
type: 'tar'
filename: tsdm_client-linux.tar.gz
directory: build/linux/x64/release/
path: tsdm_client
- name: Release Linux artifacts
uses: ncipollo/release-action@v1
with:
allowUpdates: true
omitBody: true
omitBodyDuringUpdate: true
omitPrereleaseDuringUpdate: true
artifacts: 'build/linux/x64/release/tsdm_client-linux.tar.gz'
build-android:
name: Build Android
needs: [ release ]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{env.CI_FLUTTER_VERSION}}
cache: true
- run: |
sudo ./scripts/github_free_disk_space.sh
sudo apt update -y
sudo apt install -y ninja-build libgtk-3-dev
git submodule update --init --recursive --force
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{env.CI_RUST_VERSION}}
targets: aarch64-linux-android,armv7-linux-androideabi,x86_64-linux-android,i686-linux-android
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r29
- name: Update NDK path
run: |
echo "${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin" >> $GITHUB_PATH
- name: Prepare flutter_avif
run: |
sudo apt install -y make meson nasm
cargo install cargo-ndk@3.5.4 --locked
./scripts/build-flutter_avif-android.sh
env:
ANDROID_NDK: ${{ steps.setup-ndk.outputs.ndk-path }}
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
ANDROID_NDK_LATEST_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }}
- name: Precompile
run: |
flutter pub get
dart ./Makefile.dart
- name: Setup Android sign key
run: |
echo '${{ secrets.KEYSTORE }}' | base64 --decode > android/app/key.jks
echo '${{ secrets.KEY_PROPERTIES }}' > android/key.properties
- name: Build Android
run: |
flutter build apk --release
- name: Pack Android apk
run: |
pushd build/app/outputs/flutter-apk/
mv app-arm64-v8a-release.apk tsdm_client-arm64_v8a.apk
mv app-armeabi-v7a-release.apk tsdm_client-armeabi_v7a.apk
popd
- name: Release Android artifacts
uses: ncipollo/release-action@v1
with:
allowUpdates: true
omitBody: true
omitBodyDuringUpdate: true
omitPrereleaseDuringUpdate: true
artifacts: 'build/app/outputs/flutter-apk/tsdm_client-arm64_v8a.apk,build/app/outputs/flutter-apk/tsdm_client-armeabi_v7a.apk'
build-windows:
name: Build Windows
needs: [ release ]
runs-on: windows-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{env.CI_FLUTTER_VERSION}}
- name: Precompile
shell: pwsh
run: |
git submodule update --init --recursive --force
flutter pub get
dart ./Makefile.dart
- name: Build Windows
run: flutter build windows --release
- name: Pre Packing
shell: pwsh
run: |
cd build/windows/x64/runner
Rename-Item Release tsdm_client
cd ../../../../
- name: Pack Windows tarball
uses: thedoctor0/zip-release@master
with:
type: 'zip'
filename: tsdm_client-windows.zip
directory: build/windows/x64/runner
path: tsdm_client
- name: Release Windows artifacts
uses: ncipollo/release-action@v1
with:
allowUpdates: true
omitBody: true
omitBodyDuringUpdate: true
omitPrereleaseDuringUpdate: true
artifacts: 'build/windows/x64/runner/tsdm_client-windows.zip'
build-macos-and-ios:
name: Build MacOS and iOS
needs: [ release ]
runs-on: macos-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{env.CI_FLUTTER_VERSION}}
cache: true
- name: Precompile
run: |
git submodule update --init --recursive --force
flutter pub get
dart ./Makefile.dart
- name: Build MacOS
run: |
flutter build macos --release
- name: Packing MacOS dmg
run: |
brew install python-setuptools
npm install -g appdmg
appdmg appdmg.json build/tsdm_client-universal.dmg
- name: Release macOS artifacts
uses: ncipollo/release-action@v1
with:
allowUpdates: true
omitBody: true
omitBodyDuringUpdate: true
omitPrereleaseDuringUpdate: true
artifacts: 'build/tsdm_client-universal.dmg'
- name: Build iOS ipa
run: |
flutter build ios --release --no-codesign
- name: Packing
run: |
mkdir Payload
mv build/ios/iphoneos/Runner.app Payload
zip -r9 tsdm_client.ipa Payload
- name: Release iOS artifacts
uses: ncipollo/release-action@v1
with:
allowUpdates: true
omitBody: true
omitBodyDuringUpdate: true
omitPrereleaseDuringUpdate: true
artifacts: 'tsdm_client.ipa'