build #75
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
workflow_dispatch: | |
inputs: | |
targets: | |
description: 'targets to compile' | |
default: "['MI-R4A']" | |
required: false | |
release: | |
description: 'Does it need to be published to Release?' | |
default: 'yes' | |
required: false | |
plugins: | |
description: 'json format string of include configs' | |
required: true | |
default: '{"vpnsvr":"n","vpncli":"n","vpncmd":"n","ss":"n","v2ray":"n","xray":"y","trojan":"y","ssobfs":"n","dnsforwarder":"n","adbyby":"y","adguardhome":"n","smartdns":"y","aliddns":"n","zerotier":"y","ddnsto":"n","wireguard":"n","frpc":"y","aldrive":"n","sqm":"n","mentohust":"n","scutclient":"n","njitclient":"n","minieap":"n","dogcom":"n","msdlite":"y"}' | |
env: | |
FIRMWARE_DATEPREFIX: $(TZ='Asia/Shanghai' date +%Y.%m.%d-%H%M) | |
FIRMWARE_AUTHOR: vipshmily | |
FIRMWARE_PATH: /opt/firmwares | |
MHZ: 1200 # CPU超频频率 必须为20的倍数 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
target: ${{ fromJSON(github.event.inputs.targets) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: hendrikmuhs/[email protected] | |
with: | |
key: ${{ matrix.target }} | |
append-timestamp: false | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '1.21' | |
check-latest: true | |
cache: false | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
check-latest: true | |
- name: Prepare environment | |
run: | | |
sudo apt update | |
sudo apt install libtool-bin gperf python3-docutils autopoint gettext ccache | |
- name: Parse json string of include plugins | |
run: | | |
echo "vpnsvr=${{fromJson(github.event.inputs.plugins).vpnsvr}}" >> $GITHUB_ENV | |
echo "vpncli=${{fromJson(github.event.inputs.plugins).vpncli}}" >> $GITHUB_ENV | |
echo "vpncmd=${{fromJson(github.event.inputs.plugins).vpncmd}}" >> $GITHUB_ENV | |
echo "ss=${{fromJson(github.event.inputs.plugins).ss}}" >> $GITHUB_ENV | |
echo "v2ray=${{fromJson(github.event.inputs.plugins).v2ray}}" >> $GITHUB_ENV | |
echo "xray=${{fromJson(github.event.inputs.plugins).xray}}" >> $GITHUB_ENV | |
echo "trojan=${{fromJson(github.event.inputs.plugins).trojan}}" >> $GITHUB_ENV | |
echo "ssobfs=${{fromJson(github.event.inputs.plugins).ssobfs}}" >> $GITHUB_ENV | |
echo "dnsforwarder=${{fromJson(github.event.inputs.plugins).dnsforwarder}}" >> $GITHUB_ENV | |
echo "adbyby=${{fromJson(github.event.inputs.plugins).adbyby}}" >> $GITHUB_ENV | |
echo "adguardhome=${{fromJson(github.event.inputs.plugins).adguardhome}}" >> $GITHUB_ENV | |
echo "smartdns=${{fromJson(github.event.inputs.plugins).smartdns}}" >> $GITHUB_ENV | |
echo "aliddns=${{fromJson(github.event.inputs.plugins).aliddns}}" >> $GITHUB_ENV | |
echo "zerotier=${{fromJson(github.event.inputs.plugins).zerotier}}" >> $GITHUB_ENV | |
echo "ddnsto=${{fromJson(github.event.inputs.plugins).ddnsto}}" >> $GITHUB_ENV | |
echo "wireguard=${{fromJson(github.event.inputs.plugins).wireguard}}" >> $GITHUB_ENV | |
echo "frpc=${{fromJson(github.event.inputs.plugins).frpc}}" >> $GITHUB_ENV | |
echo "aldrive=${{fromJson(github.event.inputs.plugins).aldrive}}" >> $GITHUB_ENV | |
echo "sqm=${{fromJson(github.event.inputs.plugins).sqm}}" >> $GITHUB_ENV | |
echo "mentohust=${{fromJson(github.event.inputs.plugins).mentohust}}" >> $GITHUB_ENV | |
echo "scutclient=${{fromJson(github.event.inputs.plugins).scutclient}}" >> $GITHUB_ENV | |
echo "njitclient=${{fromJson(github.event.inputs.plugins).njitclient}}" >> $GITHUB_ENV | |
echo "minieap=${{fromJson(github.event.inputs.plugins).minieap}}" >> $GITHUB_ENV | |
echo "dogcom=${{fromJson(github.event.inputs.plugins).dogcom}}" >> $GITHUB_ENV | |
echo "msdlite=${{fromJson(github.event.inputs.plugins).msdlite}}" >> $GITHUB_ENV | |
- name: Custom config | |
run: | | |
cd trunk | |
echo "CPU超频到$MHZ"mhz | |
echo "修改CPU频率" | |
clock=`echo "obase=16 ; ibase=10 ; (((($MHZ/20)-1)*16+2))" | bc` | |
echo "16进制$clock" | |
sed -i "554,555s:0xff:0x7ff:g" linux-3.4.x/arch/mips/rt2880/init.c | |
sed -i "554,556s:0xc2:0x$clock:g" linux-3.4.x/arch/mips/rt2880/init.c | |
if [ ! -f configs/templates/${{ matrix.target }}.config ] ; then | |
echo "configs/templates/${{ matrix.target }}.config not found" | |
exit 1 | |
fi | |
cp -f configs/templates/${{ matrix.target }}.config .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_TUNSAFE/d' .config #删除配置项tunsafe | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_ALIDDNS/d' .config #删除配置项阿里DDNS | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_SRELAY/d' .config #删除配置项srelay | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_ADGUARDHOME/d' .config #删除配置项adguardhome | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_SMARTDNS/d' .config #删除配置项smartdns | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_ZEROTIER/d' .config #删除配置项zerotier | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_DDNSTO/d' .config #删除配置项ddnsto | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_WIREGUARD/d' .config #删除配置项wireguard | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_FRPS/d' .config #删除配置项frp server | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_FRPC/d' .config #删除配置项frp client | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_ALDRIVER/d' .config #删除配置项阿里云盘 | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_SQM/d' .config #删除配置项QOS流控 | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_MSD_LITE/d' .config | |
sed -i '/CONFIG_FIRMWARE_CPU_900MHZ/d' .config #删除配置项超频900MHz | |
#校园网相关 | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_MENTOHUST/d' .config #删除配置项MENTOHUST | |
sed -i '/CONFIG_FIRMWARE_INCLUDE_SCUTCLIENT/d' .config #删除配置项SCUTCLIENT | |
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=${{env.vpnsvr}}" >> .config #SOFTETHERVPN | |
echo "CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CLIENT=${{env.vpncli}}" >> .config #SOFTETHERVPN | |
echo "CONFIG_FIRMWARE_INCLUDE_SOFTETHERVPN_CMD=${{env.vpncmd}}" >> .config #SOFTETHERVPN | |
#科学相关 | |
echo "CONFIG_FIRMWARE_INCLUDE_SHADOWSOCKS=${{env.ss}}" >> .config #SS plus+ | |
echo "CONFIG_FIRMWARE_INCLUDE_V2RAY=${{env.v2ray}}" >> .config #集成v2ray执行文件(3.8M左右) | |
echo "CONFIG_FIRMWARE_INCLUDE_XRAY=${{env.xray}}" >> .config #集成xray执行文件(5.6M左右),可以代替v2ray,注:如果闪存太小不够还是建议使用v2ray | |
echo "CONFIG_FIRMWARE_INCLUDE_TROJAN=${{env.trojan}}" >> .config #集成trojan执行文件(1.1M左右) | |
echo "CONFIG_FIRMWARE_INCLUDE_SSOBFS=${{env.ssobfs}}" >> .config # simple-obfs混淆插件 | |
echo "CONFIG_FIRMWARE_INCLUDE_SSSERVER=n" >> .config #SS server | |
if [[ "${{env.xray}}" == "y" && "${{ github.event.inputs.usexraymin }}" == "true" ]]; then | |
sed -i 's/+= xray/+= xraymin/g' ./user/Makefile | |
fi | |
# | |
echo "CONFIG_FIRMWARE_INCLUDE_SRELAY=n" >> .config #可以不集成 | |
echo "CONFIG_FIRMWARE_INCLUDE_TUNSAFE=n" >> .config #tunsafe | |
echo "CONFIG_FIRMWARE_INCLUDE_DNSFORWARDER=${{env.dnsforwarder}}" >> .config #dnsforwarder | |
# | |
echo "CONFIG_FIRMWARE_INCLUDE_ADBYBY=${{env.adbyby}}" >> .config #adbyby plus+ | |
# | |
echo "CONFIG_FIRMWARE_INCLUDE_ADGUARDHOME=${{env.adguardhome}}" >> .config #adguardhome | |
echo "CONFIG_FIRMWARE_INCLUDE_SMARTDNS=${{env.smartdns}}" >> .config #smartdns | |
# | |
echo "CONFIG_FIRMWARE_INCLUDE_ALIDDNS=${{env.aliddns}}" >> .config #阿里DDNS | |
echo "CONFIG_FIRMWARE_INCLUDE_ZEROTIER=${{env.zerotier}}" >> .config #zerotier ~1.3M | |
echo "CONFIG_FIRMWARE_INCLUDE_DDNSTO=${{env.ddnsto}}" >> .config #ddnsto | |
echo "CONFIG_FIRMWARE_INCLUDE_WIREGUARD=${{env.wireguard}}" >> .config #wireguard | |
echo "CONFIG_FIRMWARE_INCLUDE_FRPS=n" >> .config #frp server | |
echo "CONFIG_FIRMWARE_INCLUDE_FRPC=${{env.frpc}}" >> .config #frp client | |
# | |
echo "CONFIG_FIRMWARE_INCLUDE_ALDRIVER=${{env.aldrive}}" >> .config #阿里云盘 | |
echo "CONFIG_FIRMWARE_INCLUDE_SQM=${{env.sqm}}" >> .config #QOS流控 | |
echo "CONFIG_FIRMWARE_INCLUDE_MSD_LITE=${{env.msdlite}}" >> .config #MSD_LITE | |
echo "CONFIG_FIRMWARE_CPU_900MHZ=y" >> .config #开启超频,仅MT7621可用 | |
# | |
#校园网相关 | |
echo "CONFIG_FIRMWARE_INCLUDE_MENTOHUST=${{env.mentohust}}" >> .config #MENTOHUST | |
echo "CONFIG_FIRMWARE_INCLUDE_SCUTCLIENT=${{env.scutclient}}" >> .config #SCUTCLIENT | |
echo "CONFIG_FIRMWARE_INCLUDE_NJIT_CLIENT=${{env.njitclient}}" >> .config | |
echo "CONFIG_FIRMWARE_INCLUDE_MINIEAP=${{env.minieap}}" >> .config | |
echo "CONFIG_FIRMWARE_INCLUDE_DOGCOM=${{env.dogcom}}" >> .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: | | |
make ${{ matrix.target }} | |
echo "TAG_ANME=$(TZ='Asia/Shanghai' date +%Y.%m.%d-%H%M)" >> $GITHUB_ENV | |
- name: Organize firmware files | |
id: organize | |
run: | | |
mkdir -p $FIRMWARE_PATH/ | |
cd trunk/images | |
for firmwarefile in $(ls *.trx) | |
do sudo mv $firmwarefile $FIRMWARE_PATH/${{ env.TAG_ANME }}"_"${FIRMWARE_AUTHOR}"_"${{ matrix.target }}"_kernal3.4.trx" | |
done | |
cd $FIRMWARE_PATH | |
echo "FIRMWARE=$PWD" >> $GITHUB_ENV | |
echo "STATUS=success" >> $GITHUB_ENV | |
- name : Upload images to Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ github.event.inputs.production }}-${{ env.TAG_ANME }} | |
path: trunk/images/*.trx | |
- name: Upload images to Releases | |
uses: ncipollo/release-action@v1 | |
if: ${{ github.event.inputs.release == 'yes' }} | |
with: | |
commit: ${{ github.sha }} | |
tag: ${{ env.TAG_ANME }} | |
artifacts: trunk/images/*.trx | |
allowUpdates: true |