build custom #1
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
# 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 | |
- GHL | |
- HAR-20S2U1 | |
- JCG-836PRO | |
- JCG-AC860M | |
- JCG-Q11Pro | |
- JCG-Q20 | |
- JCG-Q20-PB | |
- JCG-Y2 | |
- K2P | |
- K2P-NANO | |
- K2P-USB | |
- 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 | |
- RE-CP-02 | |
- RE-SP-01B | |
- RM2100 | |
- RT-AC85P | |
- SIM-AX1800T | |
- TX1801 | |
- WDR8620 | |
- WE410443-TC | |
- WIA3300-10 | |
- WR1200JS | |
- XY-C1 | |
- ZTE-E8820S | |
- ZTE-E8820V2 | |
default: RM2100 | |
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":"n","v2ray":"n","xray":"n","trojan":"n","ssobfs":"n","smartdns":"y","vlmcsd":"y","ttyd":"y","iperf3":"y"}' | |
customization: | |
description: 'String JSON list of Customization' | |
required: true | |
type: string | |
default: '{"lanip":"192.168.6.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.22.3' | |
check-latest: true | |
cache: false | |
- name: Prepare environment | |
run: | | |
sudo apt-get update && sudo apt-get install -y libtool-bin gperf python3-docutils autopoint gettext ccache | |
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: ${{ github.sha }} | |
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 |