ax5-jdc #18
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: ax5-jdc | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: 0 21 * * 6 | |
env: | |
REPO_URL: https://github.com/VIKINGYFY/immortalwrt.git | |
REPO_BRANCH: main | |
CONFIG_FILE: configs/ipq60xx-all.config | |
DIY_SCRIPT: diy-script.sh | |
FIRMWARE_RELEASE: true | |
FIRMWARE_TAG: IPQ60XX | |
TZ: Asia/Shanghai | |
jobs: | |
Build: | |
runs-on: [self-hosted, Linux] | |
steps: | |
- name: Check Server Performance | |
run: | | |
echo "警告⚠" | |
echo "分配的服务器性能有限,若选择的插件过多,务必注意CPU性能!" | |
echo -e "已知CPU型号(降序): 7763,8370C,8272CL,8171M,E5-2673\n" | |
echo "--------------------------CPU信息--------------------------" | |
echo "CPU物理数量: $(cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l)" | |
echo "CPU核心数量: $(nproc)" | |
echo -e "CPU型号信息:$(cat /proc/cpuinfo | grep -m1 name | awk -F: '{print $2}')\n" | |
echo "--------------------------内存信息--------------------------" | |
echo "已安装内存详细信息:" | |
echo -e "$(sudo lshw -short -C memory | grep GiB)\n" | |
echo "--------------------------硬盘信息--------------------------" | |
echo "硬盘数量: $(ls /dev/sd* | grep -v [1-9] | wc -l)" && df -hT && date | |
- name: Initialization Environment | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
sudo -E docker rmi $(docker images -q) || true | |
sudo rm -rf /usr/share/dotnet /etc/apt/sources.list.d /usr/local/lib/android $AGENT_TOOLSDIRECTORY || true | |
sudo -E apt-get -y purge azure-cli ghc* zulu* llvm* firefox google* dotnet* powershell openjdk* mongodb* moby* || true | |
sudo -E apt-get -y update | |
sudo -E apt-get -y install mtools sudo ack antlr3 asciidoc autoconf make automake autopoint binutils bison btrfs-progs build-essential bzip2 ca-certificates ccache cmake coreutils cpio curl device-tree-compiler fastjar flex g++-multilib gawk gcc-multilib gettext git git-core gperf gzip haveged intltool jq libc6-dev-i386 libelf-dev libfuse-dev libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libpython3-dev libreadline-dev libssl-dev libtool libz-dev lrzsz mkisofs msmtp nano ninja-build p7zip p7zip-full patch pigz pkgconf python3 python3-pip python3-pyelftools python3-setuptools qemu-utils rsync scons squashfs-tools swig tar uglifyjs unzip upx upx-ucl vim wget xmlto xsltproc xxd xz-utils yasm zip zlib1g-dev zstd liblzma-dev libpam0g-dev pahole dwarves | |
sudo -E /bin/bash -c "systemctl daemon-reload; apt-get -y autoremove --purge; apt-get -y clean" || true | |
sudo -E timedatectl set-timezone "$TZ" || true | |
- name: Checkout | |
uses: actions/checkout@main | |
- name: Clone Source Code | |
run: | | |
df -hT $GITHUB_WORKSPACE | |
sudo -E rm -rf /dev/shm/build_ax5 || true | |
mkdir -p /dev/shm/build_ax5 || true | |
cd /dev/shm/build_ax5 | |
git clone $REPO_URL -b $REPO_BRANCH openwrt | |
cd openwrt | |
echo "OPENWRT_PATH=$PWD" >> $GITHUB_ENV | |
VERSION_INFO=$(git show -s --date=short --format="作者: %an<br/>时间: %cd<br/>内容: %s<br/>hash: %H") | |
echo "VERSION_INFO=$VERSION_INFO" >> $GITHUB_ENV | |
- name: Generate Variables | |
run: | | |
cp $CONFIG_FILE $OPENWRT_PATH/.config | |
cd $OPENWRT_PATH | |
make defconfig > /dev/null 2>&1 | |
SOURCE_REPO="$(echo $REPO_URL | awk -F '/' '{print $(NF)}')" | |
echo "SOURCE_REPO=$SOURCE_REPO" >> $GITHUB_ENV | |
DEVICE_TARGET=$(cat .config | grep CONFIG_TARGET_BOARD | awk -F '"' '{print $2}') | |
echo "DEVICE_TARGET=$DEVICE_TARGET" >> $GITHUB_ENV | |
DEVICE_SUBTARGET=$(cat .config | grep CONFIG_TARGET_SUBTARGET | awk -F '"' '{print $2}') | |
echo "DEVICE_SUBTARGET=$DEVICE_SUBTARGET" >> $GITHUB_ENV | |
- name: Install Feeds | |
run: | | |
cp $DIY_SCRIPT $OPENWRT_PATH/diy.sh | |
cd $OPENWRT_PATH | |
chmod +x diy.sh | |
./diy.sh | |
- name: Load Custom Configuration | |
run: | | |
[ -e files ] && cp files $OPENWRT_PATH/files | |
[ -e $CONFIG_FILE ] && cp $CONFIG_FILE $OPENWRT_PATH/.config | |
- name: Download DL Package | |
run: | | |
cd $OPENWRT_PATH | |
make defconfig | |
make download -j8 | |
find dl -size -1024c -exec ls -l {} \; | |
find dl -size -1024c -exec rm -f {} \; | |
- name: Compile Firmware | |
id: compile | |
run: | | |
cd $OPENWRT_PATH | |
mkdir -p files/etc/uci-defaults | |
cp $GITHUB_WORKSPACE/scripts/init-settings.sh files/etc/uci-defaults/99-init-settings || true | |
echo -e "$(nproc) thread compile" | |
make -j$(nproc) || make -j$(nproc) || make -j$(nproc) V=s || make -j4 || make -j4 || make -j2 || make -j1 || make -j1 V=s | |
echo "status=success" >> $GITHUB_OUTPUT | |
echo "DATE=$(date +"%Y-%m-%d %H:%M:%S")" >> $GITHUB_ENV | |
echo "FILE_DATE=$(date +"%Y.%m.%d")" >> $GITHUB_ENV | |
- name: Check Space Usage | |
if: (!cancelled()) | |
run: df -hT | |
- name: Organize Files | |
if: steps.compile.outputs.status == 'success' | |
run: | | |
cd $OPENWRT_PATH/bin/targets/*/* | |
cat sha256sums | |
cp $OPENWRT_PATH/.config build.config | |
mv -f $OPENWRT_PATH/bin/packages/*/*/*.ipk packages || true | |
mv -f $OPENWRT_PATH/bin/packages/*/*/*.apk packages || true | |
tar -zcf Packages.tar.gz packages | |
rm -rf packages feeds.buildinfo version.buildinfo | |
echo "KERNEL=$(cat *.manifest | grep ^kernel | cut -d- -f2 | tr -d ' ')" >> $GITHUB_ENV | |
echo "FIRMWARE_PATH=$PWD" >> $GITHUB_ENV | |
- name: Upload Firmware To Release | |
if: steps.compile.outputs.status == 'success' && env.FIRMWARE_RELEASE == 'true' | |
uses: ncipollo/release-action@v1 | |
with: | |
name: R${{ env.DATE }} for ${{ env.FIRMWARE_TAG }} | |
allowUpdates: true | |
tag: ${{ env.FIRMWARE_TAG }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
artifacts: ${{ env.FIRMWARE_PATH }}/* | |
body: | | |
**This is OpenWrt Firmware for ${{ env.FIRMWARE_TAG }}** | |
### 📒 固件信息 | |
- 💻 平台架构: ${{ env.DEVICE_TARGET }}-${{ env.DEVICE_SUBTARGET }} 用于 ${{ env.FIRMWARE_TAG }} 平台 | |
- ⚽ 固件源码: ${{ env.REPO_URL }} | |
- 💝 源码分支: ${{ env.REPO_BRANCH }} | |
- 🚀 内核版本: ${{ env.KERNEL }} | |
- 🌐 默认地址: 192.168.6.1 | |
- 🔑 默认密码: password | |
### 🧊 固件版本 | |
- 固件编译前最后一次➦[主源码](${{ env.REPO_URL }})更新记录 | |
- ${{ env.VERSION_INFO }} | |
- name: clean | |
run: | | |
[ ! -z $OPENWRT_PATH ] && (sudo -E rm -rf $OPENWRT_PATH || true) | |
- name: report ok | |
if: ${{ always() && (steps.compile.outputs.status == 'success' && env.FIRMWARE_PATH != '') }} | |
run: | | |
cd /dev/shm && curl "https://xanmod.key2p.com/notice?t=编译成功&msg=AX5" || true | |
- name: report fail | |
if: ${{ always() && (steps.compile.outputs.status != 'success' || env.FIRMWARE_PATH == '') }} | |
run: | | |
cd /dev/shm && curl "https://xanmod.key2p.com/notice?t=编译失败&msg=AX5" || true |