ShellCrash/.github/workflows/update_singbox_core.yaml
2024-01-04 20:22:41 +08:00

55 lines
2.2 KiB
YAML

name: Update Sing-Box Core
on:
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: |
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<7;i++));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