NapCat-Docker/get_artifacts.sh
initialencounter 70cb8c5092 initial commit
2024-04-13 02:38:14 +08:00

19 lines
638 B
Bash

#!/bin/bash
# 设置仓库信息
repository="NapNeko/NapCat.Build"
run_id="8662095740"
artifact_name="NapCat.linux.x64"
token=""
# 设置输出目录
output_dir="."
# 获取artifact ID
artifact_id=$(curl -s -X GET -H "Authorization: token $token" "https://api.github.com/repos/$repository/actions/runs/$run_id/artifacts" | jq -r ".artifacts[] | select(.name == \"$artifact_name\") | .id")
# 下载artifact
curl -s -X GET -H "Authorization: token $token" -L "https://api.github.com/repos/$repository/actions/artifacts/$artifact_id/zip" -o "$output_dir/$artifact_name.zip"
echo "编译产物已保存到$output_dir/$artifact_name.zip"