From 369bd498667e1930844fee75fd665dde71c9f4bf Mon Sep 17 00:00:00 2001 From: juewuy Date: Thu, 4 Jan 2024 20:07:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0singbox=E5=86=85=E6=A0=B8?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/update_singbox_core.yaml | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/update_singbox_core.yaml diff --git a/.github/workflows/update_singbox_core.yaml b/.github/workflows/update_singbox_core.yaml new file mode 100644 index 0000000..13875b7 --- /dev/null +++ b/.github/workflows/update_singbox_core.yaml @@ -0,0 +1,60 @@ +name: Update Sing-Box Core +on: + schedule: + - cron: 0 20 * * * + workflow_dispatch: + +env: + download_tag: ${{ github.event.inputs.tag }} + download_version: '' + download_project: SagerNet/sing-box +jobs: + Update: + runs-on: ubuntu-latest + steps: + - name: Clone Repository + uses: actions/checkout@main + - name: Init Dependencies + run: | + wget https://github.com/upx/upx/releases/download/v3.96/upx-3.96-amd64_linux.tar.xz + wget https://github.com/upx/upx/releases/download/v3.93/upx-3.93-amd64_linux.tar.xz + tar xf upx-3.96-amd64_linux.tar.xz + tar xf upx-3.93-amd64_linux.tar.xz + - name: Download Core + run: | + if [ "${download_tag}" = "Prerelease-Alpha" ] || [ "${download_tag}" = "Prerelease-Beta" ];then + download_version=$(curl -s -L -o /dev/null -w '%{url_effective}' https://github.com/${download_project}/releases/latest | grep -oE "[^/]+$" | awk -F 'v' '{print $2}') + else + download_version=${download_tag} + fi + echo "download_version=${download_version}" >> ${GITHUB_ENV} + archs=(386 amd64 armv7 arm64) + new_name=(386 amd64 armv7 armv8) + mkdir tmp + for i in "${new_name[@]}";do + wget "https://github.com/${download_project}/releases/download/${download_tag}/sing-box-${download_version}-linux-${archs[i]}.tar.gz" -O - | tar -zxvf > ./tmp/singbox-linux-${new_name[i]} + chmod +x ./tmp/singbox-linux-${new_name[i]} + if [ "${archs[i]}" != "armv5" ];then + if [[ ${archs[i]} = mips* ]];then + ./upx-3.93-amd64_linux/upx ./tmp/singbox-linux-${new_name[i]} + else + ./upx-3.96-amd64_linux/upx ./tmp/singbox-linux-${new_name[i]} + fi + fi + done + rm -fr upx* + - name: Create Release and Upload Release Asset + uses: softprops/action-gh-release@v1 + with: + tag_name: singbox_core + name: singbox_core + body: "The alpha version of singbox core \n这是singbox的官方版本内核文件\nhttps://github.com/${download_project}/releases \nZip by upx\n使用了upx进行压缩\nOnly support for ShellCrash\n仅限于ShellCrash项目使用" + draft: false + prerelease: true + files: | + ./tmp/* + - name: Cleanup Workflow + uses: Mattraks/delete-workflow-runs@main + with: + retain_days: 1 + keep_minimum_runs: 2