|
| 1 | +name: Build_mt7981_ax3000t |
| 2 | + |
| 3 | +on: |
| 4 | + repository_dispatch: |
| 5 | + workflow_dispatch: |
| 6 | + |
| 7 | +# 定时触发编译 |
| 8 | + schedule: |
| 9 | + - cron: 47 18 * * 6 |
| 10 | + |
| 11 | +# 点赞☆Star触发编译 |
| 12 | +# watch: |
| 13 | +# types: [started] |
| 14 | + |
| 15 | +jobs: |
| 16 | + Build_mt7981_ax3000t: |
| 17 | + runs-on: ubuntu-20.04 |
| 18 | + steps: |
| 19 | + - name: Clone Repository |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Initialization environment |
| 23 | + env: |
| 24 | + DEBIAN_FRONTEND: noninteractive |
| 25 | + run: | |
| 26 | + sudo timedatectl set-timezone "Asia/Shanghai" |
| 27 | + sudo -E swapoff -a |
| 28 | + sudo -E rm -f /swapfile |
| 29 | + sudo -E docker image prune -a -f |
| 30 | + sudo -E snap set system refresh.retain=2 |
| 31 | + sudo -E apt-get -y purge dotnet* firefox ghc* google* hhvm llvm* mono* mysql* openjdk* php* zulu* |
| 32 | + sudo -E apt-get -y autoremove --purge |
| 33 | + sudo -E rm -rf /usr/share/dotnet /usr/local/lib/android/sdk /etc/mysql /etc/php /usr/local/share/boost |
| 34 | + [ -n "$AGENT_TOOLSDIRECTORY" ] && sudo rm -rf "$AGENT_TOOLSDIRECTORY" |
| 35 | + sudo -E apt-get update -y |
| 36 | + sudo -E apt-get install -y ack antlr3 aria2 asciidoc autoconf automake autopoint binutils bison build-essential bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3.8 python3-pip libpython3-dev qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev libfuse-dev libfuse-dev python3-setuptools |
| 37 | + pip install aligo |
| 38 | + sudo -E apt-get clean |
| 39 | + git config --global user.name 'GitHub Actions' && git config --global user.email '[email protected]' |
| 40 | + df -h |
| 41 | + |
| 42 | + - name: Clone source code |
| 43 | + env: |
| 44 | + REPO_URL: https://github.com/hanwckf/immortalwrt-mt798x |
| 45 | + REPO_BRANCH: openwrt-21.02 |
| 46 | + run: | |
| 47 | + git clone --depth 1 $REPO_URL -b $REPO_BRANCH openwrt |
| 48 | + cd openwrt |
| 49 | + cp -f ../diy/mt798x/op1.sh ./ |
| 50 | + chmod +x ./op1.sh && ./op1.sh |
| 51 | +
|
| 52 | + - name: Update & Install feeds |
| 53 | + working-directory: ./openwrt |
| 54 | + run: | |
| 55 | + ./scripts/feeds update -a |
| 56 | +
|
| 57 | + ./scripts/feeds install -a |
| 58 | +
|
| 59 | + cp -f ../diy/mt798x/op2.sh ./ |
| 60 | + chmod +x ./op2.sh && ./op2.sh |
| 61 | +
|
| 62 | + sed -i "s/DISTRIB_DESCRIPTION='*.*'/DISTRIB_DESCRIPTION='EasyWrt-Xiaomi-AX3000T-$(date +%Y%m%d)'/g" package/base-files/files/etc/openwrt_release |
| 63 | + |
| 64 | + - name: Configuration Customization - Build_mt7981_ax3000t |
| 65 | + env: |
| 66 | + CONFIG_FILE: './configs/ARM/mt798x/mt7981_ax3000t.config' |
| 67 | + run: | |
| 68 | + [ -e $CONFIG_FILE ] && mv $CONFIG_FILE openwrt/.config |
| 69 | + cd openwrt && make defconfig |
| 70 | + |
| 71 | + - name: Download package |
| 72 | + working-directory: ./openwrt |
| 73 | + run: | |
| 74 | + make download -j$(nproc) |
| 75 | + find dl -size -1024c -exec ls -l {} \; |
| 76 | + find dl -size -1024c -exec rm -f {} \; |
| 77 | +
|
| 78 | + - name: Build firmware |
| 79 | + working-directory: ./openwrt |
| 80 | + run: | |
| 81 | + make -j$(nproc) V=s |
| 82 | + |
| 83 | + - name: Assemble Artifact |
| 84 | + id: assemble_artifact |
| 85 | + run: | |
| 86 | + rm -rf ./ARM_Out |
| 87 | + mkdir -p ./ARM_Out/ |
| 88 | + |
| 89 | + getmd5() |
| 90 | + { |
| 91 | + md5sum=`md5sum $1` |
| 92 | + md5=`echo ${md5sum% *}` |
| 93 | + md5=`echo ${md5:0:10}` |
| 94 | + } |
| 95 | + |
| 96 | + rom=openwrt/bin/targets/mediatek/mt7981/immortalwrt-mediatek-mt7981-xiaomi_mi-router-ax3000t-squashfs-sysupgrade.bin |
| 97 | + getmd5 $rom |
| 98 | + cp -a $rom ./ARM_Out/EasyWrt-Xiaomi-AX3000T-5.4-$(date +%Y%m%d)_${md5}.bin |
| 99 | + |
| 100 | + - name: Upload Firmwares |
| 101 | + uses: actions/upload-artifact@main |
| 102 | + with: |
| 103 | + name: AX3000T-OpenWrt |
| 104 | + path: ARM_Out/*.bin |
| 105 | + |
| 106 | + - name: Upload config |
| 107 | + uses: actions/upload-artifact@main |
| 108 | + with: |
| 109 | + name: ax3000t-config |
| 110 | + path: openwrt/.config |
| 111 | + |
| 112 | + - name: Upload Packages |
| 113 | + uses: actions/upload-artifact@main |
| 114 | + with: |
| 115 | + name: AX3000T-Packages |
| 116 | + path: openwrt/bin/packages |
| 117 | + |
| 118 | + - name: Generate Tag & Release Name |
| 119 | + id: generate_name |
| 120 | + run: | |
| 121 | + time=$(date +%Y%m%d%H%M%S) |
| 122 | + release_tag="$time" |
| 123 | + release_name="EasyWrt-小米AX3000T-$(date +%Y%m%d)" |
| 124 | + echo "release_name=$release_name" >> $GITHUB_OUTPUT |
| 125 | + echo "release_tag=$release_tag" >> $GITHUB_OUTPUT |
| 126 | +
|
| 127 | + - name: Create Release & Upload |
| 128 | + |
| 129 | + with: |
| 130 | + artifacts: ARM_Out/*.bin |
| 131 | + name: ${{ steps.generate_name.outputs.release_name }} |
| 132 | + tag: ${{ steps.generate_name.outputs.release_tag }} |
| 133 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 134 | + |
| 135 | + |
0 commit comments