From 631de6be36bab8585d072cef1287838a5b97488f Mon Sep 17 00:00:00 2001 From: jcleng Date: Wed, 18 Jan 2023 16:03:52 +0800 Subject: [PATCH] x86 Signed-off-by: jcleng --- .github/workflows/x86.yml | 153 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 .github/workflows/x86.yml diff --git a/.github/workflows/x86.yml b/.github/workflows/x86.yml new file mode 100644 index 0000000..c182fdd --- /dev/null +++ b/.github/workflows/x86.yml @@ -0,0 +1,153 @@ +# +# Copyright (c) 2019-2020 P3TERX +# +# This is free software, licensed under the MIT License. +# See /LICENSE for more information. +# +# https://github.com/P3TERX/Actions-OpenWrt +# Description: Build OpenWrt using GitHub Actions +# + +name: Build OpenWrt(x86) + +on: + repository_dispatch: + workflow_dispatch: + inputs: + ssh: + description: 'SSH connection to Actions' + required: false + default: 'false' + +env: + TZ: Asia/Shanghai + +jobs: + build: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: x86 + + - name: Initialization environment + env: + DEBIAN_FRONTEND: noninteractive + run: | + echo $(nproc) + free -h + sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc + sudo -E apt-get -qq update + sudo -E apt-get -qq install sudo time git-core subversion build-essential gcc-multilib libncurses5-dev zlib1g-dev gawk flex gettext wget unzip grep rsync python3 tree python3-distutils + sudo -E apt-get -qq clean + sudo timedatectl set-timezone "$TZ" + sudo mkdir -p /workdir + sudo chown $USER:$GROUPS /workdir + + - name: Clone source code + # working-directory: /workdir + run: | + pwd + git clone -b openwrt-21.02 --single-branch --depth=1 https://github.com/immortalwrt/immortalwrt openwrt + # ln -sf /workdir/openwrt $GITHUB_WORKSPACE/openwrt + ls -l + # 插件包,不要可用注释 + - name: feeds add kenzok8-package + run: | + cd openwrt + sed -i '$a src-git kenzo https://github.com/kenzok8/openwrt-packages' feeds.conf.default + sed -i '$a src-git small https://github.com/kenzok8/small' feeds.conf.default + + # - name: feeds add fw876/helloworld + # run: | + # cd openwrt + # sed -i "/helloworld/d" "feeds.conf.default" + # echo "src-git helloworld https://github.com/fw876/helloworld.git" >> "feeds.conf.default" + + - name: feeds init and download + run: | + cd openwrt + ./scripts/feeds update -a + ./scripts/feeds install -a + + - name: .config file init + run: | + cp ./.config openwrt/.config + cd openwrt + rm -rf ./bin ./build_dir ./tmp + make defconfig + cat ./.config + + + - name: Cache Hook + uses: actions/cache@v3 + with: + path: | + openwrt/bin + openwrt/build_dir + openwrt/staging_dir + openwrt/tmp + key: cache_x86_${{ hashFiles('openwrt/.config') }} + restore-keys: | + cache_x86_ + cache_x86 + cache + + - name: .config file bak + run: | + mkdir ./bin + cp ./.config ./bin/config.bak + + - name: Change IP to..192.168.8.1 + run: | + cd openwrt + sed -i "s/192.168.1.1/192.168.8.1/" package/base-files/files/bin/config_generate + cat package/base-files/files/bin/config_generate|grep lan\) + + - name: make + run: | + cd openwrt + find ./ -name *gcc + make download -j8 + rm -rf build.log + # | grep -i error + make -j$(expr $(nproc) + 12) V=99 2>&1 | tee build.log + cp build.log ./bin + grep '^CONFIG_TARGET.*DEVICE.*=y' .config | sed -r 's/.*DEVICE_(.*)=y/\1/' > DEVICE_NAME + [ -s DEVICE_NAME ] && echo "DEVICE_NAME=_$(cat DEVICE_NAME)" >> $GITHUB_ENV + echo "FILE_DATE=_$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV + + - name: FIRMWARE set path + id: organize + run: | + cd openwrt/bin/ + echo "FIRMWARE=$PWD" >> $GITHUB_ENV + + - name: Artifacts File Save + uses: actions/upload-artifact@main + with: + name: OpenWrt_firmware${{ env.DEVICE_NAME }}${{ env.FILE_DATE }} + path: ${{ env.FIRMWARE }} + + - name: Release set path + run: | + touch release.txt + cd openwrt/bin/targets/*/* + rm -rf ./packages + echo "RELEASE_PATH=$PWD" >> $GITHUB_ENV + + - name: pack bin dir + run: | + cd openwrt + tar -zcvf bin_dir.tar.gz ./bin/ + mv bin_dir.tar.gz ${{ env.RELEASE_PATH }}/ + + - name: Release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: OpenWrt_firmware${{ env.DEVICE_NAME }}${{ env.FILE_DATE }} + body_path: release.txt + files: ${{ env.RELEASE_PATH }}/*