forked from hugcabbage/shared-lede
-
Notifications
You must be signed in to change notification settings - Fork 0
329 lines (300 loc) · 9.5 KB
/
build-lienol-openwrt.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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
#
# Copyright (C) 2022-2024 hugcabbage <[email protected]>
#
# This is free software, licensed under the MIT License.
#
# <https://github.com/hugcabbage/shared-lede>
#
# The firmware code comes from lienol openwrt
#
name: build lienol openwrt
on:
workflow_dispatch:
inputs:
model:
description: '选择设备'
required: true
type: choice
options:
- 'qihoo-c301'
- 'phicomm-k3'
- 'tenda-ac9'
- 'xiaomi-ax3600'
- 'xiaomi-ax9000'
- 'h3c-magic-nx30-pro'
- 'qihoo-360t7'
- 'xiaomi-wr30u-112m-nmbm'
- 'xiaomi-wr30u-stock'
- 'xiaomi-wr30u-ubootmod'
- 'xiaomi-ax6000-stock'
- 'xiaomi-ax6000-ubootmod'
- 'redmi-ax6s'
- 'miwifi-mini'
- 'glinet-mt1300'
- 'hiwifi-hc5962'
- 'phicomm-k2p'
- 'xiaomi-3g'
- 'xiaomi-3g-v2'
- 'xiaomi-3-pro'
- 'xiaomi-4'
- 'xiaomi-4a-gigabit'
- 'xiaomi-4a-gigabit-v2'
- 'xiaomi-ac2100'
- 'xiaomi-cr6606'
- 'xiaomi-cr6608'
- 'xiaomi-cr6609'
- 'redmi-ac2100'
- 'youhua-wr1200js'
- 'glinet-mt300n-v2'
- 'glinet-microuter-n300'
- 'xiaomi-4a-100m'
- 'xiaomi-4c'
- 'miwifi-3c'
- 'miwifi-nano'
branch:
description: '选择版本'
required: true
type: choice
options:
- 'openwrt-23.05'
- 'openwrt-22.03'
- 'openwrt-21.02'
- 'main'
lan_ipad:
description: '设置LAN口IP地址(会覆盖modify脚本中的设置)'
required: false
default: ''
type: string
login_pwd:
description: '设置初始登陆密码(会覆盖modify脚本中的设置)'
required: false
default: ''
type: string
record:
description: '输入版本描述'
required: false
default: '升级内容:内核升级,更新应用版本'
type: string
release:
description: '上传到release'
required: false
default: true
type: boolean
artifact:
description: '上传到artifact'
required: false
type: boolean
permissions:
contents: write
jobs:
to-build:
name: build
runs-on: ubuntu-latest
env:
EXTRA_STR: _some
steps:
- name: Hide sensitive inputs
if: github.event_name == 'workflow_dispatch'
uses: hugcabbage/action-hide-sensitive-inputs@v1
with:
include_inputs: login_pwd
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Display initial disk space
run: |
df -h
# - name: Install zerotier and run
# run: |
# sudo snap install zerotier
# sudo zerotier join 856127940ca93cb3
# sudo apt-get install ssh -y
#
# - name: Edit
# run: |
# sudo useradd wlight -p $1$p1y180HJ$0rABdJs13H6otyNngenLp0
# sudo sh -c 'echo "wlight ALL=(ALL) ALL" >> /etc/sudoers'
- name: Display gcc version
run: |
gcc --version
sudo apt-get update
sudo apt-get install -y aria2
sudo apt-get -y upgrade gcc
gcc --version
- name: Display golang version
run: |
go version
- name: Update golang version to 1.22.5
run: |
aria2c https://go.dev/dl/go1.22.5.linux-amd64.tar.gz -o ./go1.22.5.linux-amd64.tar.gz
mkdir go
sudo tar -C ./go/ -xzf go1.22.5.linux-amd64.tar.gz
ls ./go
sudo rm -rf /usr/local/go
echo ---
ls /usr/local/
echo ---
sudo rm -f /usr/bin/go
ls /usr/bin/
echo ---
sudo tar -C /usr/local/ -xzf go1.22.5.linux-amd64.tar.gz
- name: Edit the environment
run: |
echo $PATH
if [ -d "/usr/local/go/bin" ] ; then
PATH="/usr/local/go/bin:$PATH"
fi
export PATH=$PATH
echo $PATH
- name: Display where go
run: |
whereis go
- name: Create golang link
run: |
sudo ln -s /usr/local/go/bin/go /usr/bin/go
- name: Display golang version again
run: |
/usr/local/go/bin/go version
go version
# - name: Install gcc 13
# run: |
# sudo apt-get install -y aria2 bzip2
# aria2c https://ftp.gnu.org/gnu/gcc/gcc-13.3.0/gcc-13.3.0.tar.gz -s 24 -x 16
# tar xf gcc-13.3.0.tar.gz
# rm -f gcc-13.3.0.tar.gz
# cd gcc-13.3.0/
# ./contrib/download_prerequisites
# mkdir build && cd build
# ../configure -enable-checking=release -enable-languages=c,c++ -disable-multilib
# sudo make -j8
# sudo make install
# cd ../..
# sudo rm -rf gcc-13.3.0
- name: Show gcc version
run: |
gcc --version
- name: Checkout
uses: actions/checkout@v4
with:
path: ${{ env.EXTRA_STR }}
- name: Prepare environments
env:
REQUIREMENTS: ${{ env.EXTRA_STR }}/extra-files/requirements-transit.txt
run: |
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y full-upgrade
sudo apt-get -y install gcc-multilib gettext libssh-dev
sudo apt-get clean
pip3 install -r $REQUIREMENTS
- name: Prepare deployment
id: prepare-deployment
env:
MODEL_NAME: ${{ inputs.model }}
BRANCH_NAME: ${{ inputs.branch }}
LOGIN_IP: ${{ inputs.lan_ipad }}
LOGIN_PWD: ${{ inputs.login_pwd }}
TEMP_PREFIX: ${{ env.EXTRA_STR }}
DEPLOY_DIR: ${{ env.EXTRA_STR }}/preset-lienol-openwrt
TRANSIT_PY: ${{ env.EXTRA_STR }}/extra-files/transit.py
run: |
chmod +x $TRANSIT_PY
$TRANSIT_PY
- name: Clone sources
env:
CLONE_SH: ${{ steps.prepare-deployment.outputs.clone_sh }}
run: |
chmod +x $CLONE_SH
$CLONE_SH
- name: Update feeds
run: |
./scripts/feeds clean
./scripts/feeds update -a
./scripts/feeds install -a
- name: Update golang version
run: |
rm -rf feeds/packages/lang/golang
git clone https://github.com/sbwml/packages_lang_golang -b 22.x feeds/packages/lang/golang
- name: Modify configuration
env:
MODIFY_SH: ${{ steps.prepare-deployment.outputs.modify_sh }}
run: |
chmod +x $MODIFY_SH
$MODIFY_SH
- name: Generate .config
env:
DOT_CONFIG: ${{ steps.prepare-deployment.outputs.dot_config }}
run: |
mv $DOT_CONFIG .config
make defconfig
- name: Make download
run: |
make download -j8 || make download -j1 V=s
- name: Compile
run: |
make -j$(nproc) || make -j1 V=sc
- name: Pick up files
run: |
mkdir -p _collected_firmware/packages
rm -rf $(find bin/targets/ -type d -name 'packages')
cp $(find bin/targets/ -type f) _collected_firmware
cp $(find bin/packages/ -type f -name '*.ipk') _collected_firmware/packages
cd _collected_firmware
zip -r allfiles.zip *
cd packages
zip -r ../packages.zip *
- name: Generate summary
continue-on-error: true
id: generate-summary
env:
FOR_DEVICE: ${{ steps.prepare-deployment.outputs.fordevice }}
CODE_DIR: ${{ steps.prepare-deployment.outputs.codedir }}
TRANSIT_PY: ${{ env.EXTRA_STR }}/extra-files/transit.py
run: |
chmod +x $TRANSIT_PY
$TRANSIT_PY
- name: Calculate tag version
id: calculate-version
if: inputs.release
uses: hugcabbage/next-version@v1
with:
repo_path: ${{ env.EXTRA_STR }}
- name: Upload firmware to release
id: to-release
if: steps.calculate-version.conclusion == 'success' && inputs.release
continue-on-error: true
uses: svenstaro/upload-release-action@v2
with:
file: _collected_firmware/*
tag: ${{ steps.calculate-version.outputs.version }}
release_name: ${{ steps.calculate-version.outputs.version }} lienol-${{ steps.generate-summary.outputs.stitle }}
overwrite: true
prerelease: false
body: |
${{ inputs.record }}
${{ steps.generate-summary.outputs.summary }}
file_glob: true
- name: Upload firmware to artifact
if: inputs.artifact || steps.to-release.outcome != 'success'
uses: actions/upload-artifact@v4
with:
name: collected_firmware
path: |
_collected_firmware/
!_collected_firmware/*.zip
- name: Display finishing disk space
run: |
df -h
echo "----------------------------"
du -h --max-depth=1