forked from vb1980/Padavan_CI
-
Notifications
You must be signed in to change notification settings - Fork 0
243 lines (241 loc) · 13.3 KB
/
build_vb1980_k2p_kvr.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
name: Build K2P kvr from vb1980 kvr repo
on:
workflow_dispatch:
inputs:
firmwarever:
description: 'firmware''s version'
required: true
default: '20201015'
busyboxver:
type: choice
description: 'busybox''s version'
options:
- 1.24.x
- 1.34.1
default: '1.24.x'
ssp:
type: boolean
description: 'whether to apply the patch for download ssp bin from local or remote url'
default: 'true'
uploadwet:
type: boolean
description: 'whether to upload firmware to wetransfer'
default: 'true'
pushplus:
type: boolean
description: 'whether to notify through pushplus'
default: 'false'
env:
REPOSITORY_URL: https://github.com/vb1980/Padavan-KVR.git
TOOLCHAIN_URL: https://github.com/hanwckf/padavan-toolchain/releases/download/v1.1/mipsel-linux-uclibc.tar.xz
WORK_PATH: /opt/rt-n56u
TIME_ZONE: Asia/Shanghai
TARGET_NAME: K2P
FIRMWARE_DATEPREFIX: $(date +"%Y%m%d")
FIRMWARE_AUTHOR: vb1980
FIRMWARE_PATH: /opt/firmwares
jobs:
build:
runs-on: ubuntu-20.04
if: github.event.repository.owner.id == github.event.sender.id
steps:
- name: Checkout
uses: actions/checkout@main
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update
sudo apt-get -y install unzip libtool-bin curl cmake gperf gawk flex bison nano xxd fakeroot kmod \
cpio git python-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
sudo timedatectl set-timezone "$TIME_ZONE"
- name: Clone source code
run: |
git clone --depth=1 $REPOSITORY_URL $WORK_PATH
cd $WORK_PATH/toolchain-mipsel
mkdir -p toolchain-3.4.x
wget $TOOLCHAIN_URL
tar -xvf mipsel-linux-uclibc.tar.xz -C toolchain-3.4.x
- name: Set golang
run: |
cp -f bashScripts/go.sh $(pwd)
sudo chmod 777 ./go.sh
bash ./go.sh
- name: Set busybox's version to compile
run: |
cd $WORK_PATH/trunk/user/busybox
sed -i "s/SRC_NAME=busybox.*/SRC_NAME=busybox-${{ github.event.inputs.busyboxver }}/g" ./Makefile
cd $WORK_PATH/trunk
sed -i "s/busybox_id=.*/busybox_id=\"${{ github.event.inputs.busyboxver }}\"/g" ./build_firmware_modify
- name: Recovery SSP bin files download from remote
if: github.event.inputs.ssp == 'true'
run: |
cp -f ssp/shadowsocks.sh $WORK_PATH/trunk/user/shadowsocks/scripts
#cp -f ssp/defaults.c $WORK_PATH/trunk/user/shared
#cp -f ssp/variables.c $WORK_PATH//trunk/user/httpd
cp -f ssp/Shadowsocks.asp $WORK_PATH/trunk/user/www/n56u_ribbon_fixed
cd $WORK_PATH/trunk/user/shared
#sed -i "s#https://cdn.jsdelivr.net/gh/Padavan_CI/ssp/trojan#https://cdn.jsdelivr.net/gh/${{ github.repository_owner }}/Padavan_CI/ssp/trojan#g" ./defaults.c
#sed -i "s#https://cdn.jsdelivr.net/gh/Padavan_CI/ssp/v2ray#https://cdn.jsdelivr.net/gh/${{ github.repository_owner }}/Padavan_CI/ssp/v2ray#g" ./defaults.c
- name: Update latest adg
run: |
cp -f adg/adguardhome.sh $WORK_PATH/trunk/user/adguardhome
#cp -f adg/defaults.c $WORK_PATH/trunk/user/shared
#cp -f adg/variables.c $WORK_PATH//trunk/user/httpd
cp -f adg/Advanced_adguardhome.asp $WORK_PATH/trunk/user/www/n56u_ribbon_fixed
#cd $WORK_PATH/trunk/user/adguardhome
#sed -i "s#https://cdn.jsdelivr.net/gh/chongshengB/rt-n56u/trunk/user/adguardhome/AdGuardHome#https://cdn.jsdelivr.net/gh/${{ github.repository_owner }}/Padavan_CI/adg/AdGuardHome#g" ./adguardhome.sh
- name: Custom config
run: |
cd $WORK_PATH/trunk
if [ ! -f configs/templates/$TARGET_NAME.config ] ; then
echo "configs/templates/${TARGET_NAME}.config not found"
exit 1
fi
cp -f configs/templates/$TARGET_NAME.config .config
sed -i 's/CONFIG_FIRMWARE_INCLUDE_OPENSSL_EXE=n/CONFIG_FIRMWARE_INCLUDE_OPENSSL_EXE=y/g' .config
################################################################################################
#因不同型号配置功能不一样,所以先把配置项删除,如果你自己要添加其他的,也要写上删除这一条,切记!!!
################################################################################################
sed -i '/CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_SERVER/d' .config #删除配置项SOFTETHERVPN
sed -i '/CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CLIENT/d' .config #删除配置项SOFTETHERVPN
sed -i '/CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CMD/d' .config #删除配置项SOFTETHERVPN
sed -i '/CONFIG_FIRMWARE_INCLUDE_SHADOWSOCKS/d' .config #删除配置项SS plus+
sed -i '/CONFIG_FIRMWARE_INCLUDE_SSSERVER/d' .config #删除配置项SS server
sed -i '/CONFIG_FIRMWARE_INCLUDE_DNSFORWARDER/d' .config #删除配置项DNSFORWARDER
sed -i '/CONFIG_FIRMWARE_INCLUDE_ADBYBY/d' .config #删除配置项adbyby plus+
sed -i '/CONFIG_FIRMWARE_INCLUDE_FRPC/d' .config #删除配置项FRP Client
sed -i '/CONFIG_FIRMWARE_INCLUDE_FRPS/d' .config #删除配置项FRPS Server
sed -i '/CONFIG_FIRMWARE_INCLUDE_NPC/d' .config #删除配置项NPC
sed -i '/CONFIG_FIRMWARE_INCLUDE_TUNSAFE/d' .config #删除配置项TUNSAFE
sed -i '/CONFIG_FIRMWARE_INCLUDE_ALIDDNS/d' .config #删除配置项阿里DDNS
sed -i '/CONFIG_FIRMWARE_INCLUDE_ZEROTIER/d' .config #删除配置项ZEROTIER
sed -i '/CONFIG_FIRMWARE_INCLUDE_CLOUDFLAREDDNS/d' .config #删除配置项CLOUDFLAREDDNS
sed -i '/CONFIG_FIRMWARE_INCLUDE_NVPPROXY/d' .config #删除配置项NVPPROXY
sed -i '/CONFIG_FIRMWARE_INCLUDE_DDNSTO/d' .config #删除配置项DDNSTO
sed -i '/CONFIG_FIRMWARE_INCLUDE_WIREGUARD/d' .config #删除配置项WIREGUARD
sed -i '/CONFIG_FIRMWARE_INCLUDE_ALDRIVER/d' .config #删除配置项阿里云盘
sed -i '/CONFIG_FIRMWARE_INCLUDE_SMARTDNS/d' .config
sed -i '/CONFIG_FIRMWARE_INCLUDE_SRELAY/d' .config
sed -i '/CONFIG_FIRMWARE_INCLUDE_KUMASOCKS/d' .config
sed -i '/CONFIG_FIRMWARE_INCLUDE_IPT2SOCKS/d' .config
sed -i '/CONFIG_FIRMWARE_INCLUDE_MICROSOCKS/d' .config
sed -i '/CONFIG_FIRMWARE_INCLUDE_OPENVPN/d' .config
#校园网相关开始
sed -i '/CONFIG_FIRMWARE_INCLUDE_MENTOHUST/d' .config #删除配置项MENTOHUST
sed -i '/CONFIG_FIRMWARE_INCLUDE_SCUTCLIENT/d' .config #删除配置项SCUTCLIENT
sed -i '/CONFIG_FIRMWARE_INCLUDE_NAPT66/d' .config
sed -i '/CONFIG_FIRMWARE_INCLUDE_NJIT_CLIENT/d' .config
sed -i '/CONFIG_FIRMWARE_INCLUDE_MINIEAP/d' .config
sed -i '/CONFIG_FIRMWARE_INCLUDE_DOGCOM/d' .config
#校园网相关结束
sed -i 's/CONFIG_FIRMWARE_INCLUDE_OPENSSL_EXE=n/CONFIG_FIRMWARE_INCLUDE_OPENSSL_EXE=y/g' .config
######################################################################
#以下选项是定义你需要的功能(y=集成,n=忽略),重新写入到.config文件
######################################################################
echo "CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_SERVER=n" >> .config #SOFTETHERVPN
echo "CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CLIENT=n" >> .config #SOFTETHERVPN
echo "CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CMD=n" >> .config #SOFTETHERVPN
#科学相关
echo "CONFIG_FIRMWARE_INCLUDE_SHADOWSOCKS=y" >> .config #SS plus+
echo "CONFIG_FIRMWARE_INCLUDE_V2RAY=n" >> .config #集成v2ray执行文件(3.8M左右)
echo "CONFIG_FIRMWARE_INCLUDE_XRAY=y" >> .config #集成xray执行文件(5.6M左右),可以代替v2ray,注:如果闪存太小不够还是建议使用v2ray
echo "CONFIG_FIRMWARE_INCLUDE_TROJAN=y" >> .config #集成trojan执行文件(1.1M左右)
echo "CONFIG_FIRMWARE_INCLUDE_SSOBFS=n" >> .config # simple-obfs混淆插件
echo "CONFIG_FIRMWARE_INCLUDE_SSSERVER=n" >> .config #SS server
echo "CONFIG_FIRMWARE_INCLUDE_KUMASOCKS=n" >> .config #socks5
#
echo "CONFIG_FIRMWARE_INCLUDE_IPT2SOCKS=n" >> .config
echo "CONFIG_FIRMWARE_INCLUDE_MICROSOCKS=n" >> .config
echo "CONFIG_FIRMWARE_INCLUDE_SRELAY=n" >> .config #可以不集成
echo "CONFIG_FIRMWARE_INCLUDE_TUNSAFE=n" >> .config #TUNSAFE
echo "CONFIG_FIRMWARE_INCLUDE_DNSFORWARDER=n" >> .config #DNSFORWARDER
#
echo "CONFIG_FIRMWARE_INCLUDE_FRPC=n" >> .config #内网穿透FRPC
echo "CONFIG_FIRMWARE_INCLUDE_FRPS=n" >> .config #内网穿透FRPS
echo "CONFIG_FIRMWARE_INCLUDE_NPC=n" >> .config #删除配置项NPC
#
echo "CONFIG_FIRMWARE_INCLUDE_ADBYBY=n" >> .config #adbyby plus+
echo "CONFIG_FIRMWARE_INCLUDE_KOOLPROXY=n" >> .config #KP广告过滤
#
echo "CONFIG_FIRMWARE_INCLUDE_SMARTDNS=n" >> .config #smartdns
echo "CONFIG_FIRMWARE_INCLUDE_SMARTDNSBIN=n" >> .config #smartdns二进制文件
echo "CONFIG_FIRMWARE_INCLUDE_ADGUARDHOME=n" >> .config
#
echo "CONFIG_FIRMWARE_INCLUDE_ALIDDNS=n" >> .config #阿里DDNS
echo "CONFIG_FIRMWARE_INCLUDE_ZEROTIER=n" >> .config #zerotier ~1.3M
echo "CONFIG_FIRMWARE_INCLUDE_CLOUDFLAREDDNS=n" >> .config #CLOUDFLAREDDNS
echo "CONFIG_FIRMWARE_INCLUDE_NVPPROXY=n" >> .config #NVPPROXY
echo "CONFIG_FIRMWARE_INCLUDE_DDNSTO=n" >> .config #DDNSTO
echo "CONFIG_FIRMWARE_INCLUDE_WIREGUARD=n" >> .config #WIREGUARD
#
echo "CONFIG_FIRMWARE_INCLUDE_ALDRIVER=n" >> .config #阿里云盘
#
echo "CONFIG_FIRMWARE_INCLUDE_CADDY=n" >> .config #在线文件管理服务
echo "CONFIG_FIRMWARE_INCLUDE_CADDYBIN=n" >> .config #集成caddu执行文件,此文件有13M,请注意固件大小。如果不集成,会从网上下载下来执行,不影响正常使用
echo "CONFIG_FIRMWARE_INCLUDE_ALDRIVER=n" >> .config #阿里云盘
#
echo "CONFIG_FIRMWARE_INCLUDE_WYY=n" >> .config #网易云解锁
echo "CONFIG_FIRMWARE_INCLUDE_WYYBIN=n" >> .config #网易云解锁GO版本执行文件(4M多)注意固件超大小,不集成会自动下载
#
echo "CONFIG_FIRMWARE_INCLUDE_OPENVPN=n" >> .config #openvpn
#校园网相关开始
echo "CONFIG_FIRMWARE_INCLUDE_MENTOHUST=n" >> .config #MENTOHUST
echo "CONFIG_FIRMWARE_INCLUDE_SCUTCLIENT=n" >> .config #SCUTCLIENT
echo "CONFIG_FIRMWARE_INCLUDE_NJIT_CLIENT=n" >> .config
echo "CONFIG_FIRMWARE_INCLUDE_MINIEAP=n" >> .config
echo "CONFIG_FIRMWARE_INCLUDE_DOGCOM=n" >> .config
echo "CONFIG_FIRMWARE_INCLUDE_NAPT66=n" >> .config
#校园网相关结束
#########################################################################################
#自定义添加其它功能请参考源码configs/templates/目录下的config文件。按照上面的格式添加即可
#格式如下:
#sed -i '/自定义项/d' .config
#echo "自定义项=y" >> .config
sed -i "s/FIRMWARE_BUILDS_REV=.*/FIRMWARE_BUILDS_REV=${{ github.event.inputs.firmwarever }}/g" ./versions.inc
echo '更新版本号时间'
#########################################################################################
- name: Build firmware
run: |
cd $WORK_PATH/trunk
sudo ./clear_tree
sudo ./build_firmware_modify $TARGET_NAME 0
echo "FIRMWARE_DATEPREFIX=$(date +"%Y%m%d")" >> $GITHUB_ENV
- name: Organize firmware files
id: organize
run: |
mkdir -p $FIRMWARE_PATH/
cd $WORK_PATH/trunk/images
for firmwarefile in $(ls *.trx)
do sudo mv $firmwarefile $FIRMWARE_PATH/${FIRMWARE_DATEPREFIX}"_"${FIRMWARE_AUTHOR}"_"$firmwarefile
done
cd $FIRMWARE_PATH
echo "FIRMWARE=$PWD" >> $GITHUB_ENV
echo "::set-output name=status::success"
- name : Upload packages
uses: actions/upload-artifact@main
if: steps.organize.outputs.status == 'success'
with:
name: Padavan-packages
path: ${{ env.FIRMWARE }}
- name: Upload firmware to WeTransfer
if: steps.organize.outputs.status == 'success' && github.event.inputs.uploadwet == 'true'
run: |
curl -fsSL git.io/file-transfer | sh
./transfer wet -s -p 16 --no-progress ${FIRMWARE} 2>&1 | tee wetransfer.log
echo "::warning file=wetransfer.com::$(cat wetransfer.log | grep -o -E "https?://[a-zA-Z0-9\.\/_&=@$%?~#-]*")"
echo "WETRANSFER_URL=$(cat wetransfer.log | grep -o -E "https?://[a-zA-Z0-9\.\/_&=@$%?~#-]*")" >> $GITHUB_ENV
- name: Remove obsolete firmwares on artifacts
uses: c-hive/[email protected]
if: steps.organizer.outputs.status == 'success'
with:
age: '1 day'
skip-recent: 5
- name: PushPlus Notification
uses: vb1980/Action_PushPlus@master
if: steps.organize.outputs.status == 'success' && github.event.inputs.pushplus == 'true'
with:
token: ${{ secrets.PUSHTOKEN }}
title: ${{ env.TARGET_NAME }}_Build_Completed
content: Congratulations,<br/> Your **${{ env.TARGET_NAME }}** padavan firmware build completed!<br/> 🐮WeTransfer Download Url:${{ env.WETRANSFER_URL }}<br/> Enjoy it🎈🎁!