From decaa5c260535c302a0d59d53b598bb409fd54dd Mon Sep 17 00:00:00 2001 From: P3TERX <25927179+P3TERX@users.noreply.github.com> Date: Sat, 2 Mar 2024 16:39:16 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=95=8A=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .config | 1 + ...{build-openwrt.yml => openwrt-builder.yml} | 74 ++++++------------- .github/workflows/update-checker.yml | 27 +++---- LICENSE | 2 +- README.md | 9 +-- diy-part1.sh | 12 +-- diy-part2.sh | 16 ++-- 7 files changed, 57 insertions(+), 84 deletions(-) create mode 100644 .config rename .github/workflows/{build-openwrt.yml => openwrt-builder.yml} (62%) diff --git a/.config b/.config new file mode 100644 index 0000000..ab7a11a --- /dev/null +++ b/.config @@ -0,0 +1 @@ +# This is an empty file, please overwrite it after generating the .config file with the source code \ No newline at end of file diff --git a/.github/workflows/build-openwrt.yml b/.github/workflows/openwrt-builder.yml similarity index 62% rename from .github/workflows/build-openwrt.yml rename to .github/workflows/openwrt-builder.yml index 12e54d6..b6c50d8 100644 --- a/.github/workflows/build-openwrt.yml +++ b/.github/workflows/openwrt-builder.yml @@ -1,23 +1,20 @@ # -# Copyright (c) 2019-2020 P3TERX +# https://github.com/P3TERX/Actions-OpenWrt +# +# File: .github/workflows/openwrt-bulder.yml +# Description: Build OpenWrt using GitHub Actions +# +# Copyright (c) 2019-2024 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 +name: OpenWrt Builder on: repository_dispatch: workflow_dispatch: - inputs: - ssh: - description: 'SSH connection to Actions' - required: false - default: 'false' env: REPO_URL: https://github.com/coolsnowwolf/lede @@ -28,14 +25,12 @@ env: DIY_P2_SH: diy-part2.sh UPLOAD_BIN_DIR: false UPLOAD_FIRMWARE: true - UPLOAD_COWTRANSFER: false - UPLOAD_WETRANSFER: false - UPLOAD_RELEASE: false + UPLOAD_RELEASE: true TZ: Asia/Shanghai jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Checkout @@ -45,9 +40,10 @@ jobs: env: DEBIAN_FRONTEND: noninteractive run: | - sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc + sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force sudo -E apt-get -qq update - sudo -E apt-get -qq install $(curl -fsSL git.io/depends-ubuntu-2004) + 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 libfuse-dev libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libpython3-dev libreadline-dev libssl-dev libtool lrzsz mkisofs msmtp ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pyelftools python3-setuptools 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" @@ -82,13 +78,6 @@ jobs: cd openwrt $GITHUB_WORKSPACE/$DIY_P2_SH - - name: SSH connection to Actions - uses: P3TERX/ssh2actions@v1.0.0 - if: (github.event.inputs.ssh == 'true' && github.event.inputs.ssh != 'false') || contains(github.event.action, 'ssh') - env: - TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} - TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} - - name: Download package id: package run: | @@ -104,7 +93,7 @@ jobs: cd openwrt echo -e "$(nproc) thread compile" make -j$(nproc) || make -j1 || make -j1 V=s - echo "::set-output name=status::success" + echo "status=success" >> $GITHUB_OUTPUT 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 @@ -127,7 +116,7 @@ jobs: cd openwrt/bin/targets/*/* rm -rf packages echo "FIRMWARE=$PWD" >> $GITHUB_ENV - echo "::set-output name=status::success" + echo "status=success" >> $GITHUB_OUTPUT - name: Upload firmware directory uses: actions/upload-artifact@main @@ -136,36 +125,17 @@ jobs: name: OpenWrt_firmware${{ env.DEVICE_NAME }}${{ env.FILE_DATE }} path: ${{ env.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 | sh - ./transfer cow --block 2621440 -s -p 64 --no-progress ${FIRMWARE} 2>&1 | tee cowtransfer.log - echo "::warning file=cowtransfer.com::$(cat cowtransfer.log | grep https)" - echo "::set-output name=url::$(cat cowtransfer.log | grep https | cut -f3 -d" ")" - - - 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 | sh - ./transfer wet -s -p 16 --no-progress ${FIRMWARE} 2>&1 | tee wetransfer.log - echo "::warning file=wetransfer.com::$(cat wetransfer.log | grep https)" - echo "::set-output name=url::$(cat wetransfer.log | grep https | cut -f3 -d" ")" - - name: Generate release tag id: tag if: env.UPLOAD_RELEASE == 'true' && !cancelled() run: | - echo "::set-output name=release_tag::$(date +"%Y.%m.%d-%H%M")" + echo "release_tag=$(date +"%Y.%m.%d-%H%M")" >> $GITHUB_OUTPUT 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 "::set-output name=status::success" + [ ${UPLOAD_GOFILE} = true && ${{ steps.gofile.outputs.url }} ] && echo "🔗 [GoFile](${{ steps.gofile.outputs.url }})" >> release.txt + echo "status=success" >> $GITHUB_OUTPUT - name: Upload firmware to release - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@master if: steps.tag.outputs.status == 'success' && !cancelled() env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -175,13 +145,13 @@ jobs: files: ${{ env.FIRMWARE }}/* - name: Delete workflow runs - uses: GitRML/delete-workflow-runs@main + uses: Mattraks/delete-workflow-runs@main with: - retain_days: 1 - keep_minimum_runs: 3 + retain_days: 0 + keep_minimum_runs: 2 - name: Remove old Releases - uses: dev-drprasad/delete-older-releases@v0.1.0 + uses: dev-drprasad/delete-older-releases@master if: env.UPLOAD_RELEASE == 'true' && !cancelled() with: keep_latest: 3 diff --git a/.github/workflows/update-checker.yml b/.github/workflows/update-checker.yml index 9344c8e..ac2cd36 100644 --- a/.github/workflows/update-checker.yml +++ b/.github/workflows/update-checker.yml @@ -1,13 +1,14 @@ # -# Copyright (c) 2019-2021 P3TERX -# -# This is free software, licensed under the MIT License. -# See /LICENSE for more information. -# # https://github.com/P3TERX/Actions-OpenWrt +# # File: .github/workflows/update-checker.yml # Description: Source code update checker # +# Copyright (c) 2019-2024 P3TERX +# +# This is free software, licensed under the MIT License. +# See /LICENSE for more information. +# name: Update Checker @@ -30,14 +31,14 @@ jobs: id: getHash run: | git clone --depth 1 $REPO_URL -b $REPO_BRANCH . - echo "::set-output name=commitHash::$(git rev-parse HEAD)" + echo "commitHash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - name: Compare Commit Hash id: cacheHash - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: .commitHash - key: HEAD-${{ steps.getHash.outputs.commitHash }} + key: commitHash_${{ steps.getHash.outputs.commitHash }} - name: Save New Commit Hash if: steps.cacheHash.outputs.cache-hit != 'true' @@ -46,13 +47,13 @@ jobs: - name: Trigger build if: steps.cacheHash.outputs.cache-hit != 'true' - uses: peter-evans/repository-dispatch@v1 + uses: peter-evans/repository-dispatch@v2 with: - token: ${{ secrets.ACTIONS_TRIGGER_PAT }} + token: ${{ github.token }} event-type: Source Code Update - name: Delete workflow runs - uses: GitRML/delete-workflow-runs@main + uses: Mattraks/delete-workflow-runs@v2 with: - retain_days: 1 - keep_minimum_runs: 1 + retain_days: 0 + keep_minimum_runs: 2 diff --git a/LICENSE b/LICENSE index 6123c79..d081cfb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019-2020 P3TERX +Copyright (c) 2019-2024 P3TERX Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 9252c02..9c3ebc8 100644 --- a/README.md +++ b/README.md @@ -27,15 +27,10 @@ A template for building OpenWrt with GitHub Actions - [Microsoft Azure](https://azure.microsoft.com) - [GitHub Actions](https://github.com/features/actions) - [OpenWrt](https://github.com/openwrt/openwrt) -- [Lean's OpenWrt](https://github.com/coolsnowwolf/lede) -- [tmate](https://github.com/tmate-io/tmate) -- [mxschmitt/action-tmate](https://github.com/mxschmitt/action-tmate) -- [csexton/debugger-action](https://github.com/csexton/debugger-action) -- [Cowtransfer](https://cowtransfer.com) -- [WeTransfer](https://wetransfer.com/) +- [coolsnowwolf/lede](https://github.com/coolsnowwolf/lede) - [Mikubill/transfer](https://github.com/Mikubill/transfer) - [softprops/action-gh-release](https://github.com/softprops/action-gh-release) -- [ActionsRML/delete-workflow-runs](https://github.com/ActionsRML/delete-workflow-runs) +- [Mattraks/delete-workflow-runs](https://github.com/Mattraks/delete-workflow-runs) - [dev-drprasad/delete-older-releases](https://github.com/dev-drprasad/delete-older-releases) - [peter-evans/repository-dispatch](https://github.com/peter-evans/repository-dispatch) diff --git a/diy-part1.sh b/diy-part1.sh index 105598a..572003d 100755 --- a/diy-part1.sh +++ b/diy-part1.sh @@ -1,18 +1,18 @@ #!/bin/bash # -# 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 # File name: diy-part1.sh # Description: OpenWrt DIY script part 1 (Before Update feeds) # +# Copyright (c) 2019-2024 P3TERX +# +# This is free software, licensed under the MIT License. +# See /LICENSE for more information. +# # Uncomment a feed source #sed -i 's/^#\(.*helloworld\)/\1/' feeds.conf.default # Add a feed source -#echo 'src-git helloworld https://github.com/fw876/helloworld' >>feeds.conf.default +echo 'src-git helloworld https://github.com/fw876/helloworld' >>feeds.conf.default #echo 'src-git passwall https://github.com/xiaorouji/openwrt-passwall' >>feeds.conf.default diff --git a/diy-part2.sh b/diy-part2.sh index 45acc88..a0228d0 100755 --- a/diy-part2.sh +++ b/diy-part2.sh @@ -1,14 +1,20 @@ #!/bin/bash # -# 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 # File name: diy-part2.sh # Description: OpenWrt DIY script part 2 (After Update feeds) # +# Copyright (c) 2019-2024 P3TERX +# +# This is free software, licensed under the MIT License. +# See /LICENSE for more information. +# # Modify default IP #sed -i 's/192.168.1.1/192.168.50.5/g' package/base-files/files/bin/config_generate + +# Modify default theme +#sed -i 's/luci-theme-bootstrap/luci-theme-argon/g' feeds/luci/collections/luci/Makefile + +# Modify hostname +#sed -i 's/OpenWrt/P3TERX-Router/g' package/base-files/files/bin/config_generate