name: Update Meta Alpha Core on: schedule: - cron: "0 20 * * 1,3,5,6" workflow_dispatch: env: download_tag: Prerelease-Alpha download_version: '' download_url: https://github.com/MetaCubeX/Clash.Meta/releases/download 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 -sL https://api.github.com/repos/MetaCubeX/Clash.Meta/releases/tags/${download_tag} | grep linux-arm64 | head -n 1 | sed 's_.gz.*__;s_.*arm64-__') else download_version=${download_tag} fi echo "download_version=${download_version}" >> ${GITHUB_ENV} archs=(amd64-compatible armv5 armv7 arm64 mips-softfloat mipsle-hardfloat mipsle-softfloat) new_name=(amd64 armv5 armv7 armv8 mips-softfloat mipsle-hardfloat mipsle-softfloat) mkdir tmp for((i=0;i<7;i++));do wget "${download_url}/${download_tag}/Clash.Meta-linux-${archs[i]}-${download_version}.gz" -O - | gunzip -c > ./tmp/clash-linux-${new_name[i]} chmod +x ./tmp/clash-linux-${new_name[i]} if [ "${archs[i]}" != "armv5" ];then if [[ ${archs[i]} = mips* ]];then ./upx-3.93-amd64_linux/upx ./tmp/clash-linux-${new_name[i]} else ./upx-3.96-amd64_linux/upx ./tmp/clash-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: clash.meta.alpha name: clash.meta.alpha body: "The alpha version of clash.meta core \n这是clash.meta的Alpha版本内核文件\nhttps://github.com/MetaCubeX/Clash.Meta/releases/tag/Prerelease-Alpha \nZip by upx\n使用了upx进行压缩\nOnly support for ShellClash\n仅限于ShellClash项目使用" draft: false prerelease: true files: | ./tmp/* - name: Commit and push version run: | sed -i "s/meta.a_v=.*/meta.a_v=$(./tmp/clash-linux-amd64 -v 2>/dev/null | head -n 1 | sed 's/ linux.*//;s/.* //')/" bin/version rm -fr ./tmp git config --global user.email "juewuy@126.com" && git config --global user.name "Bot" git add . && git commit -m "更新Meta.Alpha内核至${download_version}" || exit 0 git push