name: Update Sing-Box Core on: workflow_dispatch: inputs: version: description: 'version of singbox, such as 1.7.8' required: true type: string env: download_version: ${{ github.event.inputs.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<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 -rf core.tar.gz rm -fr upx* - name: Create Release and Upload Release Asset uses: softprops/action-gh-release@v1 with: tag_name: singbox_core name: singbox_core draft: false prerelease: true files: | ./tmp/* - name: Cleanup Workflow uses: Mattraks/delete-workflow-runs@main with: retain_days: 1 keep_minimum_runs: 2