更改 ll 别名 #5
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: R4S-OpenWrt | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'master' | |
paths: | |
- 'PATCH/**' | |
- 'SCRIPTS/**' | |
- 'SEED/**' | |
env: | |
TZ: Asia/Shanghai | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Maximize build space | |
uses: easimon/maximize-build-space@master | |
with: | |
swap-size-mb: 512 | |
temp-reserve-mb: 128 | |
root-reserve-mb: 3072 | |
remove-dotnet: 'true' | |
remove-android: 'true' | |
remove-haskell: 'true' | |
remove-codeql: 'true' | |
- name: Checkout | |
uses: actions/checkout@main | |
- name: Show CPU Model | |
run: | | |
echo -e "Total CPU cores\t: $(nproc)" | |
cat /proc/cpuinfo | grep 'model name' | |
ulimit -a | |
- name: Init build dependencies | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
sudo swapoff -a | |
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 aria2 | |
sudo -E wget -P /usr/local/sbin/ https://github.com/HiGarfield/lede-17.01.4-Mod/raw/master/.github/backup/apt-fast | |
sudo -E chmod -R 755 /usr/local/sbin/apt-fast | |
sudo -E apt-fast -y -qq install dwarves llvm clang lldb lld build-essential rsync asciidoc binutils bzip2 gawk gettext git libncurses5-dev patch python2.7 unzip zlib1g-dev lib32gcc-s1 libc6-dev-i386 subversion flex uglifyjs gcc-multilib p7zip-full msmtp libssl-dev texinfo libreadline-dev libglib2.0-dev xmlto qemu-utils upx-ucl libelf-dev autoconf automake libtool autopoint device-tree-compiler g++-multilib antlr3 gperf wget ccache curl swig coreutils vim nano python3 python3-dev python3-pip python3-ply python3-pyelftools lrzsz scons | |
pip3 install --user -U pylibfdt | |
sudo -E apt-get -qq autoremove --purge | |
sudo -E apt-get -qq clean | |
sudo -E git config --global user.name 'GitHub Actions' && git config --global user.email '[email protected]' | |
sudo -E git config --global core.abbrev auto | |
df -h | |
- name: Merge Nick's Code | |
run: | | |
git clone --single-branch -b main https://github.com/RikudouPatrickstar/Nicholas-OpenWrt.git OpenWrt-Autobuild | |
mv ./OpenWrt-Autobuild/SCRIPTS/* ./SCRIPTS/ | |
mv ./SCRIPTS/R4S/* ./SCRIPTS/ | |
mv ./OpenWrt-Autobuild/PATCH/* ./PATCH/ | |
mv -f ./PATCH/zzz-default-settings ./PATCH/duplicate/addition-trans-zh-rockchip/files/zzz-default-settings | |
sed -i "s/NanoPi-<model_name>/NanoPi-R4S/g" ./PATCH/duplicate/addition-trans-zh-rockchip/files/zzz-default-settings | |
mv ./OpenWrt-Autobuild/SEED/* ./SEED/ | |
rm -rf ./OpenWrt-Autobuild/ | |
- name: Get OpenWrt Code | |
run: | | |
sudo chown -R runner:runner ${GITHUB_WORKSPACE} | |
cp ./SCRIPTS/01_get_ready.sh ./ | |
/bin/bash 01_get_ready.sh | |
cp -r ./SCRIPTS/* ./openwrt/ | |
df -h | |
- name: Generate Information | |
run: | | |
compile_date=$(date +%Y-%m-%d_%H-%M) | |
tag_name=R4S-${compile_date} | |
version_number=$(cat ./openwrt/include/version.mk | grep 'VERSION_NUMBER),' | awk -F ',' '{print $3}' | sed 's_)__g') | |
version_code=$(cat ./openwrt/include/version.mk | grep 'VERSION_CODE),' | awk -F ',' '{print $3}' | sed 's_)__g') | |
release_name=R4S-OpenWrt_v${version_number}_${compile_date} | |
commit_id=$(git log | grep commit | head -n 1 | sed 's/commit //') | |
echo "compile_date=${compile_date}" >> ${GITHUB_ENV} | |
echo "tag_name=${tag_name}" >> ${GITHUB_ENV} | |
echo "version_number=${version_number}" >> ${GITHUB_ENV} | |
echo "version_code=${version_code}" >> ${GITHUB_ENV} | |
echo "release_name=${release_name}" >> ${GITHUB_ENV} | |
echo "commit_id=${commit_id}" >> ${GITHUB_ENV} | |
echo "- OpenWrt 版本:${version_number} ${version_code}" > DESC.md | |
- name: Prepare Package | |
run: | | |
cd ./openwrt/ | |
/bin/bash my_prepare_package.sh | |
/bin/bash 02_R4S.sh | |
- name: Convert Translation | |
run: | | |
cd ./openwrt/ | |
/bin/bash 03_convert_translation.sh | |
- name: Remove Upx | |
run: | | |
cd ./openwrt/ | |
/bin/bash 04_remove_upx.sh | |
- name: Add ACL | |
run: | | |
cd ./openwrt/ | |
/bin/bash 05_create_acl_for_luci.sh -a | |
- name: Make Config | |
run: | | |
cd ./openwrt/ | |
mv ../SEED/r4s-config.seed .config | |
make defconfig | |
- name: Smart Chmod | |
run: | | |
MY_Filter=$(mktemp) | |
echo '/\.git' > ${MY_Filter} | |
echo '/\.svn' >> ${MY_Filter} | |
find ./ -maxdepth 1 | grep -v '\./$' | grep -v '/\.git' | xargs -s1024 chmod -R u=rwX,og=rX | |
find ./ -type f | grep -v -f ${MY_Filter} | xargs -s1024 file | grep 'executable\|ELF' | cut -d ':' -f1 | xargs -s1024 chmod 755 | |
rm -f ${MY_Filter} | |
unset MY_Filter | |
- name: Make Download | |
run: | | |
cd ./openwrt/ | |
make download -j48 | |
- name: Make Toolchain | |
run: | | |
cd ./openwrt/ | |
let make_process=$(nproc)+1 | |
make toolchain/install -j${make_process} V=m | |
- name: Compile Openwrt | |
run: | | |
cd ./openwrt/ | |
let make_process=$(nproc)+1 | |
make -j${make_process} V=m || make -j${make_process} V=m || make -j1 V=s | |
df -h | |
- name: Package Artifact | |
run: | | |
cd ./openwrt/ | |
sudo -E /bin/bash my_package_artifact.sh | |
df -h | |
- name: Upload Artifact | |
uses: actions/upload-artifact@main | |
with: | |
name: ${{ env.release_name }} | |
path: ./openwrt/bin/targets/rockchip/armv8/* | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: ./openwrt/bin/targets/rockchip/armv8/* | |
name: ${{ env.release_name }} | |
tag: ${{ env.tag_name }} | |
commit: ${{ env.commit_id }} | |
bodyFile: ./DESC.md | |
token: ${{ secrets.GITHUB_TOKEN }} |