forked from tsl0922/padavan
-
Notifications
You must be signed in to change notification settings - Fork 54
248 lines (246 loc) · 10.1 KB
/
custom.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
# Build TurBoTse's kernal4.4 Padavan
name: build custom
on:
workflow_dispatch:
inputs:
target:
description: 'Select the router device'
required: true
type: choice
options:
- 360-T6M
- 360-T6M-PB
- B70
- BELL-A040WQ
- C-Life-XG1
- CR660x
- DIR-878
- DIR-882
- EA7500
- G-AX1800
- G-AX1800-B
- GHL
- HAR-20S2U1
- JCG-836PRO
- JCG-AC860M
- JCG-Q10Pro
- JCG-Q10Pro-PB
- JCG-Q11Pro
- JCG-Q20
- JCG-Q20-PB
- JCG-Y2
- JDCLOUD-RE-CP-02
- JDCLOUD-RE-SP-01B
- K2P
- K2P-NANO
- K2P-USB
- KOMI-A8
- MI-4
- MI-R3G
- MI-R3P-PB
- MI-R3P-SPI
- MI-R3P
- MI-R4A
- MR2600
- MSG1500
- MSG1500-Z
- NETGEAR-BZV
- NETGEAR-R6800
- NETGEAR-R7450
- NEWIFI
- NEWIFI3
- QM-B1
- R2100
- RM2100
- RT-AC85P
- SIM-AX1800T
- TX1801
- WDR8620
- WRL18M4GD
- WE410443-TC
- WIA3300-10
- WR1200JS
- XY-C1
- ZTE-E8820S
- ZTE-E8820V2
- ZTT-RX6000
default: K2P
toolchain:
description: 'Select the compilation toolchain'
required: true
type: choice
options:
- mipsel-linux-musl
- mipsel-linux-uclibc
default: mipsel-linux-musl
toolchaingcc:
description: 'Select the toolchain gcc version'
required: true
type: choice
options:
- mipsel-linux-musl
- mipsel-linux-musl-gcc7
- mipsel-linux-musl-gcc10
- mipsel-linux-uclibc
- mipsel-linux-uclibc-gcc7
- mipsel-linux-uclibc-gcc10
default: mipsel-linux-musl
cpufreq:
description: 'CPU Frequency (MHz)'
type: boolean
default: false
mt7621_oc:
description: '1000Mhz=0x312 1100Mhz=0x362 1120Mhz=0x372 1200Mhz=0x3B2'
type: choice
options:
- '0x312'
- '0x362'
- '0x372'
- '0x3B2'
plugins:
description: 'String JSON list of plug-ins'
required: true
type: string
default: '{"ss":"y","v2ray":"n","xray":"y","trojan":"y","ssobfs":"y","smartdns":"y","vlmcsd":"y","ttyd":"n","iperf3":"n"}'
customization:
description: 'String JSON list of Customization'
required: true
type: string
default: '{"lanip":"192.168.2.1","signaccount":"admin","signpassword":"admin","wifi2gssid":"Padavan","wifi2gpsk":"1234567890","wifi5gssid":"Padavan-5G","wifi5gpsk":"1234567890"}'
nanoversion:
type: boolean
description: 'Compile the nano version'
default: false
release:
type: boolean
description: 'Upload firmware to release'
default: true
oldworkflow:
type: boolean
description: 'Delete old workflow runs'
default: true
env:
FIRMWARE_AUTHOR: TurBoTse
TOOLCHAIN_ROOT: toolchain/toolchain-mipsel
TOOLCHAIN_URL: https://github.com/TurBoTse/padavan/releases/download/toolchain
jobs:
build:
runs-on: ubuntu-latest
env:
target: ${{ matrix.target }}
toolchain: ${{ matrix.toolchain }}
toolchaingcc: ${{ matrix.toolchaingcc }}
strategy:
matrix:
include:
- target: ${{ inputs.target }}
toolchain: ${{ inputs.toolchain }}
toolchaingcc: ${{ inputs.toolchaingcc }}
steps:
- uses: actions/checkout@main
- uses: hendrikmuhs/ccache-action@main
with:
key: ${{ matrix.target }}-${{ matrix.toolchaingcc }}
- uses: actions/setup-go@main
with:
go-version: '1.23.5'
check-latest: true
cache: false
- name: Prepare environment
run: |
sudo apt-get update && sudo apt-get install -y unzip libtool-bin ccache curl cmake gperf gawk flex bison nano xxd \
fakeroot kmod cpio bc zip git python3-docutils gettext automake autopoint \
texinfo build-essential help2man pkg-config zlib1g-dev libgmp3-dev \
libmpc-dev libmpfr-dev libncurses5-dev libltdl-dev wget libc-dev-bin liblzma-dev
echo "TRUNK_DIR=${{ github.workspace }}/trunk" >> $GITHUB_ENV
echo "Compilation_time=$(TZ='Asia/Shanghai' date +%Y%m%d)" >> $GITHUB_ENV
- name: Prepare toolchain
run: |
mkdir -p ${{ github.workspace }}/$TOOLCHAIN_ROOT
curl -fSsLo- $TOOLCHAIN_URL/${{ matrix.toolchaingcc }}.tar.xz | tar Jxv -C ${{ github.workspace }}/$TOOLCHAIN_ROOT
- name: Parse the string JSON list
run: |
echo "lanip=${{fromJson(inputs.customization).lanip}}" >> $GITHUB_ENV
echo "signaccount=${{fromJson(inputs.customization).signaccount}}" >> $GITHUB_ENV
echo "signpassword=${{fromJson(inputs.customization).signpassword}}" >> $GITHUB_ENV
echo "wifi2gssid=${{fromJson(inputs.customization).wifi2gssid}}" >> $GITHUB_ENV
echo "wifi2gpsk=${{fromJson(inputs.customization).wifi2gpsk}}" >> $GITHUB_ENV
echo "wifi5gssid=${{fromJson(inputs.customization).wifi5gssid}}" >> $GITHUB_ENV
echo "wifi5gpsk=${{fromJson(inputs.customization).wifi5gpsk}}" >> $GITHUB_ENV
# plugins
echo "ss=${{fromJson(inputs.plugins).ss}}" >> $GITHUB_ENV
echo "v2ray=${{fromJson(inputs.plugins).v2ray}}" >> $GITHUB_ENV
echo "xray=${{fromJson(inputs.plugins).xray}}" >> $GITHUB_ENV
echo "trojan=${{fromJson(inputs.plugins).trojan}}" >> $GITHUB_ENV
echo "ssobfs=${{fromJson(inputs.plugins).ssobfs}}" >> $GITHUB_ENV
echo "smartdns=${{fromJson(inputs.plugins).smartdns}}" >> $GITHUB_ENV
echo "vlmcsd=${{fromJson(inputs.plugins).vlmcsd}}" >> $GITHUB_ENV
echo "ttyd=${{fromJson(inputs.plugins).ttyd}}" >> $GITHUB_ENV
echo "iperf3=${{fromJson(inputs.plugins).iperf3}}" >> $GITHUB_ENV
- name: Compile the nano version
if: ${{ github.event.inputs.nanoversion == 'true' }}
run: |
cd ${{ env.TRUNK_DIR }}/configs/templates
for M in ${{ matrix.target }}; do if [ -f $M.config ]; then
for MOD in ANTFS FAT EXFAT EXT2 EXT3 EXT4 XFS FUSE SWAP; do
sed -i "s/CONFIG_FIRMWARE_ENABLE_${MOD}=y/CONFIG_FIRMWARE_ENABLE_${MOD}=n/" $M.config; done
for MOD in UVC HID SERIAL AUDIO XFRM QOS IMQ IFB NFSD NFSC CIFS NTFS_3G LPRD U2EC TCPDUMP HDPARM PARTED SMBD WINS SMBD_SYSLOG FTPD RPL2TP EAP_PEAP HTTPS SFTP DROPBEAR_FAST_CODE OPENSSH OPENVPN SSWAN OPENSSL_EC OPENSSL_EXE XUPNPD MINIDLNA FIREFLY FFMPEG_NEW TRANSMISSION TRANSMISSION_WEB_CONTROL ARIA ARIA_WEB_CONTROL CURL SCUTCLIENT GDUT_DRCOM DOGCOM MINIEAP NJIT_CLIENT SOFTETHERVPN_SERVER SOFTETHERVPN_CLIENT SOFTETHERVPN_CMD VLMCSD TTYD LITE LRZSZ HTOP NANO IPERF3 DUMP1090 RTL_SDR MTR SOCAT SRELAY MENTOHUST FRPC FRPS REDSOCKS SHADOWSOCKS XRAY V2RAY TROJAN SSOBFS SINGBOX NAIVEPROXY ADBYBY DNSFORWARDER SMARTDNS ADGUARDHOME ZEROTIER ALIDDNS DDNSTO ALDRIVER SQM WIREGUARD; do
sed -i "s/CONFIG_FIRMWARE_INCLUDE_${MOD}=y/CONFIG_FIRMWARE_INCLUDE_${MOD}=n/" $M.config; done
fi; done
- name: Modify and customize
run: |
sed -i '/cp -f/d' ${{ github.workspace }}/Makefile
cd ${{ env.TRUNK_DIR }}
sh ./custom/scripts/setip.sh '${{ env.lanip }}' './user/shared/src/defaults.h' './user/www/dict/CN.dict'
sh ./custom/scripts/setaccount.sh '${{ env.signaccount }}' '${{ env.signpassword }}' './user/shared/src/defaults.h'
sh ./custom/scripts/setwifi.sh '${{ env.wifi2gssid }}' '${{ env.wifi2gpsk }}' '${{ env.wifi5gssid }}' '${{ env.wifi5gpsk }}' './user/shared/src/defaults.h'
if [ ! -f configs/templates/${{ matrix.target }}.config ]; then
echo "configs/templates/${{ matrix.target }}.config not found"
exit 0
fi
cp -f configs/templates/${{ matrix.target }}.config .config
# include plugin
echo "CONFIG_FIRMWARE_INCLUDE_SHADOWSOCKS=${{env.ss}}" >> .config
echo "CONFIG_FIRMWARE_INCLUDE_V2RAY=${{env.v2ray}}" >> .config
echo "CONFIG_FIRMWARE_INCLUDE_XRAY=${{env.xray}}" >> .config
echo "CONFIG_FIRMWARE_INCLUDE_TROJAN=${{env.trojan}}" >> .config
echo "CONFIG_FIRMWARE_INCLUDE_SSOBFS=${{env.ssobfs}}" >> .config
echo "CONFIG_FIRMWARE_INCLUDE_SMARTDNS=${{env.smartdns}}" >> .config
echo "CONFIG_FIRMWARE_INCLUDE_VLMCSD=${{env.vlmcsd}}" >> .config
echo "CONFIG_FIRMWARE_INCLUDE_TTYD=${{env.ttyd}}" >> .config
echo "CONFIG_FIRMWARE_INCLUDE_IPERF3=${{env.iperf3}}" >> .config
# cpufreq
if ${{ github.event.inputs.cpufreq == 'true' }}; then
echo "CONFIG_FIRMWARE_INCLUDE_OC=y" >> .config
echo "CONFIG_FIRMWARE_MT7621_OC=${{ inputs.mt7621_oc }}" >> .config
fi
- name: Start build firmware
run: |
make ${{ matrix.target }} TOOLCHAIN=${{ matrix.toolchain }}
nano=""
if ${{ github.event.inputs.nanoversion == 'true' }}; then
nano="-nano"
fi
cpufreq=""
if ${{ github.event.inputs.cpufreq == 'true' }}; then
cpufreq="-cpufreq-${{ inputs.mt7621_oc }}"
fi
mkdir -p ${{ env.TRUNK_DIR }}/firmwares/
sudo mv ${{ env.TRUNK_DIR }}/images/*.trx ${{ env.TRUNK_DIR }}/firmwares/$FIRMWARE_AUTHOR-${{ matrix.target }}-4.4-${{ matrix.toolchaingcc }}${nano}${cpufreq}-${{ env.Compilation_time }}.trx
- uses: actions/upload-artifact@main
with:
name: ${{ matrix.target }}-${{ matrix.toolchaingcc }}
path: trunk/firmwares/*.trx
- uses: ncipollo/release-action@main
if: ${{ github.event.inputs.release == 'true' }}
with:
commit: main
tag: ${{ env.Compilation_time }}
artifacts: trunk/firmwares/*.trx
allowUpdates: true
omitBodyDuringUpdate: true
- uses: Mattraks/delete-workflow-runs@main
if: ${{ github.event.inputs.oldworkflow == 'true' }}
with:
retain_days: 0
keep_minimum_runs: 1