-
Notifications
You must be signed in to change notification settings - Fork 16
110 lines (108 loc) · 4.38 KB
/
build_asuswrt_modx_next.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
name: Build Asuswrt-Modx Next
on:
workflow_dispatch:
inputs:
branch:
type: choice
description: 'branch to build'
options:
#- main
- 5.2.2
default:
5.2.2
target:
type: choice
description: 'target to build'
options:
- RT-AX18T
- RT-CMCCA9
- RT-CR660X
- RT-HAR
- RT-Q20
- RT-TX1801
- RT-XG1
- RT-MIR3G
default:
RT-AX18T
applypatch:
type: boolean
description: 'apply patch to display lan numbers'
default: 'true'
uploadanon:
type: boolean
description: 'upload firmware to anonfiles'
default: 'false'
env:
REPOSITORY_URL: https://github.com/stkuroneko/asuswrt-modx-next.git
TOOLCHAINS_URL: https://github.com/SWRT-dev/mtk-toolchains.git
WORK_PATH: /home/runner/work
SRC_PATH: /home/runner/work/asuswrt-modx-next
TOOLCHAINS_PATH: /home/runner/work/mtk-toolchains
TIME_ZONE: Asia/Shanghai
FIRMWARE_PATH: /home/runner/work/firmwares
jobs:
build:
runs-on: ubuntu-20.04
if: github.event.repository.owner.id == github.event.sender.id
steps:
- uses: actions/checkout@v3
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo dpkg --add-architecture i386
sudo dpkg -l | awk '/ii lib.*deb.sury.org/ {gsub(/:.*/, s, $2); print $2}' | xargs apt show -a | awk '/Package:/ {p=$2} /APT-Sources: .*focal\/main/ {print p"/focal"}' | sudo xargs eatmydata apt install --allow-downgrades
sudo apt update
sudo apt-get -y --no-install-recommends install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev
sudo apt-get -y --no-install-recommends install patch python3.5 python2.7 unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core
sudo apt-get -y --no-install-recommends install gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev
sudo apt-get -y --no-install-recommends install autoconf automake libtool autopoint device-tree-compiler g++-multilib antlr3 gperf wget libncurses5:i386
sudo apt-get -y --no-install-recommends install libelf1:i386 lib32z1 lib32stdc++6 gtk-doc-tools intltool binutils-dev cmake lzma liblzma-dev lzma-dev
sudo apt-get -y --no-install-recommends install uuid-dev liblzo2-dev xsltproc dos2unix libstdc++5 docbook-xsl-* sharutils autogen shtool gengetopt
sudo apt-get -y --no-install-recommends install libltdl-dev libtool-bin bison
sudo timedatectl set-timezone "$TIME_ZONE"
- name: Clone source code
run: |
git clone -b ${{ github.event.inputs.branch }} --depth=1 $REPOSITORY_URL $SRC_PATH
git clone --depth=1 $TOOLCHAINS_URL $TOOLCHAINS_PATH
- name: Apply patch
if: github.event.inputs.applypatch == 'true'
run: |
sudo cp -f patch/fix_lan_numbers.patch $SRC_PATH/fix_lan_numbers.patch
cd $SRC_PATH
sudo chmod 777 ./fix_lan_numbers.patch
git apply -p1 < fix_lan_numbers.patch
- name: Build
run: |
sudo cp -f scripts/build_next.sh $WORK_PATH/build.sh
cd $WORK_PATH
sudo chmod 777 ./build.sh
bash ./build.sh ${{ github.event.inputs.target }}
- name: Organize firmware files
run: |
mkdir -p $FIRMWARE_PATH/
cd $SRC_PATH/release/src-ra-openwrt-4210/image
for firmwarefile in $(ls *.trx)
do sudo mv $firmwarefile $FIRMWARE_PATH/$firmwarefile
done
cd $FIRMWARE_PATH
echo "FIRMWARE=$PWD" >> $GITHUB_ENV
echo "STATUS=success" >> $GITHUB_ENV
- name : Upload packages
uses: actions/upload-artifact@main
if: env.STATUS == 'success'
with:
name: Asuswrt-Next-packages
path: ${{ env.FIRMWARE }}
- name: Upload firmware to anonfiles
if: env.STATUS == 'success' && github.event.inputs.uploadanon == 'true'
run: |
curl -fsSL git.io/file-transfer | sh
./transfer anon --no-progress ${FIRMWARE} 2>&1 | tee anonfile.log
echo "::warning file=anonfile.com::$(cat anonfile.log | grep -o -E "https?://[a-zA-Z0-9\.\/_&=@$%?~#-]*")"
- name: Remove obsolete firmwares on artifacts
uses: c-hive/[email protected]
if: env.STATUS == 'success'
with:
age: '1 day'
skip-recent: 5