fix more. #559
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
#================================================= | |
# https://github.com/Lancenas/Actions-Lean-OpenWrt | |
# Description: Build OpenWrt using GitHub Actions | |
# Lisence: MIT | |
# Author: P3TERX | |
# Blog: https://P3TERX.com | |
#================================================= | |
name: Build OpenWrt | |
on: | |
repository_dispatch: | |
workflow_dispatch: | |
inputs: | |
ssh: | |
description: 'SSH connection to Actions' | |
required: false | |
default: 'false' | |
release: | |
types: published | |
push: | |
branches: | |
- master | |
paths: | |
- 'wndr4300.config' | |
# schedule: | |
# - cron: 0 8 * * 5 | |
watch: | |
types: started | |
env: | |
REPO_URL: https://github.com/coolsnowwolf/lede | |
REPO_BRANCH: master | |
# REPO_URL: https://github.com/coolsnowwolf/openwrt | |
# REPO_BRANCH: lede-17.01 | |
# REPO_URL: https://github.com/openwrt/openwrt | |
# REPO_BRANCH: master | |
# REPO_URL: https://github.com/lede-project/source | |
# REPO_BRANCH: openwrt-19.07 | |
# REPO_URL: https://github.com/carrot93/openwrt | |
# REPO_BRANCH: master | |
FEEDS_CONF: feeds.conf.default | |
CONFIG_FILE: wndr4300.config | |
DIY_P1_SH: diy-part1.sh | |
DIY_P2_SH: diy-part2.sh | |
SSH_ACTIONS: false | |
UPLOAD_BIN_DIR: true | |
UPLOAD_FIRMWARE: true | |
UPLOAD_COWTRANSFER: true | |
UPLOAD_WETRANSFER: true | |
UPLOAD_RELEASE: true | |
TZ: Asia/Shanghai | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: github.event.repository.owner.id == github.event.sender.id | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: cli env | |
uses: volta-cli/action@v4 | |
- name: wait 60s | |
uses: GuillaumeFalourd/wait-sleep-action@v1 | |
with: | |
time: '60' | |
- name: Node LTS versions | |
uses: msimerson/node-lts-versions@v1.1.1 | |
with: | |
node-version: 16 | |
- name: setup node version | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 16 | |
# - name: Set the value | |
# id: step_one | |
# run: | | |
# # echo "{environment_variable_name}={value}" >> $GITHUB_ENV | |
# # echo "{name}={value}" >> $GITHUB_OUTPUT | |
# echo '::set-output name=action_echo::disabled' | |
- name: Initialization environment | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
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 build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs gcc-multilib g++-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler antlr3 gperf | |
sudo -E apt-get -qq install ack antlr3 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 python3-pip libpython3-dev qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev | |
sudo -E apt-get -qq autoremove --purge | |
sudo -E apt-get -qq clean | |
sudo timedatectl set-timezone "$TZ" | |
- name: Clone source code | |
run: | | |
git clone --depth 1 $REPO_URL -b $REPO_BRANCH openwrt | |
- name: Load custom feeds | |
run: | | |
[ -e $FEEDS_CONF ] && mv $FEEDS_CONF openwrt/feeds.conf.default | |
chmod +x $DIY_P1_SH | |
cd openwrt | |
# custom package source | |
# cat >> feeds.conf.default <<EOF | |
# src-git packages_1 https://github.com/openwrt/packages | |
# src-git luci_1 https://github.com/openwrt/luci | |
# EOF | |
# git clone https://github.com/CPqD/openflow-openwrt.git package/openflow-openwrt | |
# git clone https://github.com/sunkai2012sky/mwan3-zh-cn.git package/luci-i18n-mwan3 | |
# git clone https://github.com/chenhw2/openwrt-dnsmasq-extra.git package/openwrt-dnsmasq-extra | |
# git clone https://github.com/honwen/openwrt-shadowsocks-rust.git package/openwrt-shadowsocks-rust | |
# git clone https://github.com/honwen/luci-app-shadowsocks-rust.git package/luci-app-shadowsocks-rust | |
# pushd package/luci-app-shadowsocks-rust/tools/po2lmo | |
# make && sudo make install | |
# popd | |
# git clone --branch lede https://github.com/Romaluo/luci-app-smartdns.git package/luci-app-smartdns | |
# git clone https://github.com/pymumu/smartdns.git package/smartdns | |
# git clone https://github.com/kankankankankankan/luci-app-adguardhome package/luci-app-adguardhome | |
# git clone https://github.com/AdguardTeam/AdGuardHome package/AdGuardHome | |
# git clone https://github.com/AlexZhuo/luci-app-pdnsd.git package/luci-app-pdnsd | |
# git clone https://github.com/mengskysama/openwrt-pdnsd.git package/openwrt-pdnsd | |
../$DIY_P1_SH | |
# rm -rf feeds/luci/applications/luci-app-turboacc | |
# git clone https://github.com/AutoCONFIG/luci-app-turboacc.git feeds/luci/applications/luci-app-turboacc | |
- name: Update feeds | |
run: cd openwrt && ./scripts/feeds update -a | |
- name: Install feeds | |
run: cd openwrt && ./scripts/feeds install -a | |
- name: Load custom configuration | |
run: | | |
[ -e files ] && mv files openwrt/files | |
[ -e $CONFIG_FILE ] && mv -f $CONFIG_FILE openwrt/.config | |
chmod +x $DIY_P2_SH | |
cd openwrt | |
../$DIY_P2_SH | |
- name: SSH connection to Actions | |
uses: P3TERX/ssh2actions@v1.0.0 | |
if: env.SSH_ACTIONS == 'true' || contains(github.event.action, 'ssh') | |
- name: Download package | |
id: package | |
run: | | |
cd openwrt | |
sed -i 's/KERNEL_PATCHVER:=5.10/KERNEL_PATCHVER:=5.15/g' ./target/linux/ath79/Makefile | |
# sed -i 's/KERNEL_PATCHVER:=5.15/KERNEL_PATCHVER:=5.19/g' ./target/linux/ath79/Makefile | |
make clean | |
# make savedefconfig | |
# ./scripts/diffconfig.sh > defconfig | |
# cat defconfig >> .config | |
sed -i 's/^[ \t]*//g' ./.config | |
# cp .config config.uniq | |
# sort .config.uniq | uniq > .config | |
# cat >> .config <<EOF | |
# CONFIG_PACKAGE_pdnsd=y | |
# EOF | |
# CONFIG_PACKAGE_luci-app-mwan3=y | |
# CONFIG_PACKAGE_mwan3=y | |
# CONFIG_PACKAGE_luci-app-p910nd=y | |
# CONFIG_PACKAGE_luci-i18n-p910nd-zh-cn=y | |
# CONFIG_PACKAGE_p910nd=y | |
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_V2ray_Plugin=y | |
# CONFIG_BUSYBOX_DEFAULT_KLOGD=y | |
# CONFIG_PACKAGE_luci-app-mwan3helper=y | |
# CONFIG_BUSYBOX_DEFAULT_FEATURE_KLOGD_KLOGCTL=y | |
# CONFIG_BUSYBOX_DEFAULT_LOGGER=y | |
# CONFIG_PACKAGE_shadowsocks-rust-sslocal=y | |
# CONFIG_PACKAGE_shadowsocks-rust-ssserver=y | |
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks_Rust_Client=y | |
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks_Rust_Server=y | |
# CONFIG_PACKAGE_v2ray-plugin=y | |
# CONFIG_PACKAGE_v2ray-core=y | |
# CONFIG_PACKAGE_openflow=y | |
# CONFIG_PACKAGE_luci-i18n-mwan3-zh-cn=y | |
make defconfig | |
./scripts/diffconfig.sh > seed.config | |
make download -j8 | |
# V=s | |
find dl -size -1024c -exec ls -l {} \; | |
find dl -size -1024c -exec rm -f {} \; | |
- name: Compile the firmware | |
id: compile | |
run: | | |
cd openwrt | |
echo -e "$(nproc) thread compile" | |
# make -j$(nproc) V=s || make -j1 V=s || make -j1 V=sc | |
make -j$(nproc) || make -j1 || make -j1 V=sc | |
# PKG_HASH=skip | |
echo "status=success" >>$GITHUB_OUTPUT | |
- name: Upload bin directory | |
uses: actions/upload-artifact@main | |
if: steps.compile.outputs.status == 'success' && env.UPLOAD_BIN_DIR == 'true' | |
with: | |
name: OpenWrt_bin_${{ steps.compile.outputs.DEVICE_NAME }}_${{ steps.compile.outputs.FILE_DATE }} | |
path: openwrt/bin | |
- name: Organize files | |
id: organize | |
if: env.UPLOAD_FIRMWARE == 'true' && !cancelled() | |
run: | | |
cd openwrt/bin/targets/*/* | |
rm -rf packages | |
echo "FIRMWARE=$PWD" >>$GITHUB_OUTPUT | |
echo "status=success" >>$GITHUB_OUTPUT | |
- name: Upload firmware directory | |
uses: actions/upload-artifact@main | |
if: steps.organize.outputs.status == 'success' && !cancelled() | |
with: | |
name: OpenWrt_firmware_${{ steps.compile.outputs.DEVICE_NAME }}_${{ steps.compile.outputs.FILE_DATE }} | |
path: ${{ steps.organize.outputs.FIRMWARE }} | |
# - name: Upload firmware to cowtransfer | |
# id: cowtransfer | |
# if: steps.organize.outputs.status == 'success' && env.UPLOAD_COWTRANSFER == 'true' && !cancelled() | |
#run: | | |
# curl -fsSL git.io/file-transfer | bash -s beta | |
# ./transfer cow --block 2621440 -s -p 64 --no-progress ${{ steps.organize.outputs.FIRMWARE }} 2>&1 | tee cowtransfer.log | |
# echo "::warning file=cowtransfer.com::$(cat cowtransfer.log | grep https)" | |
# echo "url=$(cat cowtransfer.log | grep https | cut -f3 -d" ")" >>$GITHUB_OUTPUT | |
# - name: Upload firmware to WeTransfer | |
# id: wetransfer | |
# if: steps.organize.outputs.status == 'success' && env.UPLOAD_WETRANSFER == 'true' && !cancelled() | |
# run: | | |
# curl -fsSL git.io/file-transfer | bash -s beta | |
# ./transfer wet -s -p 16 --no-progress ${{ steps.organize.outputs.FIRMWARE }} 2>&1 | tee wetransfer.log | |
# echo "::warning file=wetransfer.com::$(cat wetransfer.log | grep https)" | |
# echo "url=$(cat wetransfer.log | grep https | cut -f3 -d" ")" >>$GITHUB_OUTPUT | |
- name: Generate release tag | |
id: tag | |
if: env.UPLOAD_RELEASE == 'true' && !cancelled() | |
run: | | |
# echo "name=release_tag::$(date +"%Y.%m.%d-%H%M")" >>$GITHUB_OUTPUT | |
echo "::set-output name=release_tag::$(date +"%Y.%m.%d-%H%M")" | |
touch release.txt | |
[ $UPLOAD_COWTRANSFER = true ] && echo "🔗 [Cowtransfer](${{ steps.cowtransfer.outputs.url }})" >> release.txt | |
[ $UPLOAD_WETRANSFER = true ] && echo "🔗 [WeTransfer](${{ steps.wetransfer.outputs.url }})" >> release.txt | |
echo "status=success" >>$GITHUB_OUTPUT | |
- name: Upload firmware to release | |
uses: softprops/action-gh-release@v0.1.14 | |
if: steps.tag.outputs.status == 'success' && !cancelled() | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.tag.outputs.release_tag }} | |
body_path: release.txt | |
files: ${{ env.FIRMWARE }}/* | |
- name: Delete workflow runs | |
uses: GitRML/delete-workflow-runs@main | |
with: | |
retain_days: 1 | |
keep_minimum_runs: 3 | |
- name: Remove old Releases | |
uses: dev-drprasad/delete-older-releases@v0.2.0 | |
if: env.UPLOAD_RELEASE == 'true' && !cancelled() | |
with: | |
keep_latest: 3 | |
delete_tags: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |