Update Meta Alpha Core #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Meta Alpha Core | |
on: | |
schedule: | |
- cron: 0 20 * * * | |
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: Cleanup Workflow | |
uses: Mattraks/delete-workflow-runs@main | |
with: | |
retain_days: 1 | |
keep_minimum_runs: 2 |