-
Notifications
You must be signed in to change notification settings - Fork 5
193 lines (190 loc) · 6.39 KB
/
test_build.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
name: Test build
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
inputs:
build_android:
description: Build Android platform artifacts.
required: true
type: boolean
default: true
build_ios:
description: Build iOS platform artifacts.
required: true
type: boolean
default: true
build_linux:
description: Build Linux platform artifacts.
required: true
type: boolean
default: true
build_macos:
description: Build MacOS platform artifacts.
required: true
type: boolean
default: true
build_windows:
description: Build Windows platform artifacts.
required: true
type: boolean
default: true
dry_run:
description: Dry run, do NOT upload artifacts.
required: true
type: boolean
default: true
env:
CI_FLUTTER_VERSION: '3.16.x'
jobs:
build-linux-android:
name: Build Linux and Android
if: ${{ github.event_name == "push" || inputs.build_linux || inputs.build_android }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '11'
- 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
- name: Precompile
run: |
flutter pub get
dart run build_runner build
- name: Build Linux
if: ${{ github.event_name == "push" || inputs.build_linux }}
run: flutter build linux --release
- name: Pre Packing
if: ${{ github.event_name == "push" || inputs.build_linux }}
run: |
pushd build/linux/x64/release/
mv bundle tsdm_client
popd
- name: Pack Linux tarball
if: ${{ github.event_name == "push" || inputs.build_linux }}
uses: thedoctor0/zip-release@master
with:
type: 'tar'
filename: tsdm_client-linux.tar.gz
directory: build/linux/x64/release/
path: tsdm_client
- name: Upload Linux artifacts
if: ${{ github.event_name != "push" && inputs.build_linux && !inputs.dry_run }}
uses: actions/upload-artifact@v3
with:
name: tsdm_client-linux-tarball
path: build/linux/x64/release/tsdm_client-linux.tar.gz
- name: Setup Android sign key
if: ${{ github.event_name == "push" || inputs.build_android }}
run: |
echo '${{ secrets.KEYSTORE }}' | base64 --decode > android/app/key.jks
echo '${{ secrets.KEY_PROPERTIES }}' > android/key.properties
- name: Build Android
if: ${{ github.event_name == "push" || inputs.build_android }}
run: |
flutter build apk --release
- name: Pack Android apk
if: ${{ github.event_name == "push" || inputs.build_android }}
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: Upload Android artifacts
if: ${{ github.event_name != "push" && inputs.build_android && !inputs.dry_run }}
uses: actions/upload-artifact@v3
with:
name: tsdm_client-apk-arm64_v8a
path: |
build/app/outputs/flutter-apk/tsdm_client-arm64_v8a.apk
build-windows:
name: Build Windows
if: ${{ github.event_name == "push" || inputs.build_windows }}
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{env.CI_FLUTTER_VERSION}}
- name: Precompile
run: |
flutter pub get
dart run build_runner build
- 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: Upload Windows artifacts
if: ${{ github.event_name != "push" && !inputs.dry_run }}
uses: actions/upload-artifact@v3
with:
name: tsdm_client-windows-tarball
path: build/windows/x64/runner/tsdm_client-windows.zip
build-macos-and-ios:
name: Build MacOS and iOS
if: ${{ github.event_name == "push" || inputs.build_macos || inputs.build_ios }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{env.CI_FLUTTER_VERSION}}
cache: true
- name: Precompile
run: |
flutter pub get
dart run build_runner build
- name: Build MacOS
if: ${{ github.event_name == "push" || inputs.build_macos }}
run: |
flutter build macos --release
- name: Packing MacOS dmg
if: ${{ github.event_name == "push" || inputs.build_macos }}
run: |
python3 -m pip install setuptools
npm install -g appdmg
appdmg appdmg.json build/tsdm_client-universal.dmg
- name: Upload MacOS artifacts
if: ${{ github.event_name != "push" && inputs.build_macos && !inputs.dry_run }}
uses: actions/upload-artifact@v3
with:
name: tsdm_client-macos-tarball
path: build/tsdm_client-universal.dmg
- name: Build iOS ipa
if: ${{ github.event_name == "push" || inputs.build_ios }}
run: |
flutter build ios --release --no-codesign
- name: Packing
if: ${{ github.event_name == "push" || inputs.build_ios }}
run: |
mkdir Payload
mv build/ios/iphoneos/Runner.app Payload
zip -r9 tsdm_client.ipa Payload
- name: Upload iOS artifacts
if: ${{ github.event_name != "push" && inputs.build_ios && !inputs.dry_run }}
uses: actions/upload-artifact@v3
with:
name: tsdm_client-ios-tarball
path: tsdm_client.ipa