-
Notifications
You must be signed in to change notification settings - Fork 74
230 lines (203 loc) · 8.01 KB
/
workflow_dispatch.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
name: ADBKIT CI
on:
workflow_dispatch:
inputs:
custom_runner:
description: '是否使用自定义Runner'
required: true
repository_dispatch:
types:
- api
jobs:
clone-code:
strategy:
matrix:
os:
- "${{ github.event.inputs.custom_runner == 'true' && 'self-hosted-mac' || 'macos-latest' }}"
- "${{ github.event.inputs.custom_runner == 'true' && 'self-hosted-windows' || 'windows-latest' }}"
- "${{ github.event.inputs.custom_runner == 'true' && 'self-hosted-linux' || 'ubuntu-latest' }}"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current code
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Checkout adb_kit_extension code
uses: actions/checkout@v3
with:
repository: 'mengyanshou/adb_kit_extension'
token: ${{ secrets.GH_PAT }}
ref: 'main'
path: "${{ github.workspace }}/adb_kit_extension"
- name: Checkout termux_api_plugin code
uses: actions/checkout@v3
with:
repository: 'nightmare-space/termux_api_plugin'
token: ${{ secrets.GH_PAT }}
ref: 'main'
path: "${{ github.workspace }}/termux_api_plugin"
- name: Checkout user_center_frontend code
uses: actions/checkout@v3
with:
repository: 'mengyanshou/user_center_frontend'
token: ${{ secrets.GH_PAT }}
ref: 'main'
path: "${{ github.workspace }}/user_center_frontend"
- name: Checkout behavior_api code
uses: actions/checkout@v3
with:
repository: 'mengyanshou/behavior_api'
token: ${{ secrets.GH_PAT }}
ref: 'main'
path: "${{ github.workspace }}/behavior_api"
- name: Checkout ni CLI code
uses: actions/checkout@v3
with:
repository: 'mengyanshou/ni'
token: ${{ secrets.GH_PAT }}
ref: 'main'
path: "${{ github.workspace }}/ni"
- name: Cache Primes
id: cache-primes
uses: actions/cache@v3
with:
path: ${{ github.workspace }}
key: ${{ runner.os }}-dart-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-dart-
build-linux:
runs-on: ${{ github.event.inputs.custom_runner == 'true' && 'self-hosted-linux' || 'ubuntu-latest' }}
environment: default
needs: clone-code
steps:
- name: Restore cached Primes
id: cache-primes-restore
uses: actions/cache/restore@v3
with:
path: |
${{ github.workspace }}
key: ${{ runner.os }}-dart-
- name: move file
run: |
mv "${{ github.workspace }}/user_center_frontend" "${{ github.workspace }}/../user_center_frontend"
mv "${{ github.workspace }}/adb_kit_extension" "${{ github.workspace }}/../adb_kit_extension"
mv "${{ github.workspace }}/termux_api_plugin" "${{ github.workspace }}/../termux_api_plugin"
mv "${{ github.workspace }}/behavior_api/behavior.dart" "./lib/global/instance/behavior.dart"
mv "${{ github.workspace }}/behavior_api/behavior.g.dart" "./lib/global/instance/behavior.g.dart"
- name: Install and set Flutter version
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Setup other environment
if: github.event.inputs.custom_runner == 'false'
run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev
# tray manager need
sudo apt-get install libayatana-appindicator3-dev
- name: Setup CLI environment
run: |
cd ${{ github.workspace }}/ni
dart pub get
- name: Building...
run: |
export PATH=$PATH:${{ github.workspace }}/ni
ni release --build-linux-deb
- name: Upload..
run: |
export PATH=$PATH:${{ github.workspace }}/ni
ni default -u
build-mac:
runs-on: ${{ github.event.inputs.custom_runner == 'true' && 'self-hosted-mac' || 'macos-latest' }}
needs: clone-code
environment: default
steps:
- name: Run on ${{ github.job.runs-on }}
run: echo "This job runs on ${{ github.job.runs-on }}"
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- name: Restore cached Primes
id: cache-primes-restore
uses: actions/cache/restore@v3
with:
path: |
${{ github.workspace }}
key: ${{ runner.os }}-dart-
- name: move file
run: |
mv "${{ github.workspace }}/user_center_frontend" "${{ github.workspace }}/../user_center_frontend"
mv "${{ github.workspace }}/adb_kit_extension" "${{ github.workspace }}/../adb_kit_extension"
mv "${{ github.workspace }}/termux_api_plugin" "${{ github.workspace }}/../termux_api_plugin"
mv "${{ github.workspace }}/behavior_api/behavior.dart" "./lib/global/instance/behavior.dart"
mv "${{ github.workspace }}/behavior_api/behavior.g.dart" "./lib/global/instance/behavior.g.dart"
- name: List files in the repository
run: |
ls ${{ github.workspace }}/..
- name: Setup node environment
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install and set Flutter version
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Setup CLI environment
run: |
cd ${{ github.workspace }}/ni
dart pub get
- name: Setup other environment
run: |
# brew install create-dmg
npm install -g appdmg
- name: Building&&Packaging
run: |
export PATH=$PATH:${{ github.workspace }}/ni
ni release --build-mac-dmg
# ./scripts/dmg/create_dmg.sh
- name: Upload
run: |
export PATH=$PATH:${{ github.workspace }}/ni
ni default -u
build-windows:
runs-on: ${{ github.event.inputs.custom_runner == 'true' && 'self-hosted-windows' || 'windows-latest' }}
environment: default
needs: clone-code
steps:
- name: Restore cached Primes
id: cache-primes-restore
uses: actions/cache/restore@v3
with:
path: |
${{ github.workspace }}
key: ${{ runner.os }}-dart-
- name: move file
run: |
Move-Item -Path "${{ github.workspace }}/user_center_frontend" -Destination "${{ github.workspace }}/../"
Move-Item -Path "${{ github.workspace }}/adb_kit_extension" -Destination "${{ github.workspace }}/../"
Move-Item -Path "${{ github.workspace }}/termux_api_plugin" -Destination "${{ github.workspace }}/../"
Move-Item -Path "${{ github.workspace }}/behavior_api/behavior.dart" -Destination "./lib/global/instance/behavior.dart"
Move-Item -Path "${{ github.workspace }}/behavior_api/behavior.g.dart" -Destination "./lib/global/instance/behavior.g.dart"
- name: Install and set Flutter version
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Setup CLI environment
if: always()
run: |
cd ${{ github.workspace }}\ni
dart pub get
- name: Building...
if: always()
run: |
set PATH=%PATH%;${{ github.workspace }}\ni
ni release --build-win-zip
shell: cmd
- name: Upload
if: always()
run: |
set PATH=%PATH%;${{ github.workspace }}\ni
ni default -u
shell: cmd