Files
ShellCrash/.github/workflows/update_singbox_core.yaml
2024-01-04 21:15:54 +08:00

56 lines
2.3 KiB
YAML

name: Update Sing-Box Core
on:
workflow_dispatch:
env:
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: |
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}')
echo "download_version=${download_version}" >> ${GITHUB_ENV}
archs=(386 amd64 armv7 arm64)
new_name=(386 amd64 armv7 armv8)
mkdir tmp
for((i=0;i<4;i++));do
wget "https://github.com/${download_project}/releases/download/v${download_version}/sing-box-${download_version}-linux-${archs[i]}.tar.gz" -O ./tmp/core.tar.gz
tar -zxvf ./tmp/core.tar.gz -C './tmp'
mv -f ./tmp/sing-box-${download_version}-linux-${archs[i]}/sing-box ./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 -rf ./tmp/LICENSE
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