Files
LuminolMC/scripts/PushToAPI.sh
2024-04-13 00:17:36 +08:00

29 lines
1.1 KiB
Bash

sha256() {
sha256sum $1 | awk '{print $1}'
}
prop() {
grep "${1}" gradle.properties | cut -d'=' -f2 | sed 's/\r//'
}
project_id="luminol"
mcversion_group=$(prop GroupMCV)
mcversion=$(prop mcVersion)
pre=$(prop preVersion)
if [ $pre = "true" ]; then
channel="experimental"
else
channel="default"
fi
changes=$(git log -1 --pretty="[{'commit': '%H', 'message': '%s', 'summary': '%b'}]")
jar_sha256=`sha256 build/libs/luminol-1.20.4-paperclip.jar`
jar_name="luminol-1.20.4-paperclip.jar"
ctime=$(date -u +"%s")"000"
# v2
echo "Authentication: $secret_v2"
echo "[DEBUG] curl --location --request POST "https://api.luminolmc.com/v2/projects/$project_id/$mcversion/build/commit" -H "Content-Type: application/json" -H "Authorization: $secret_v2" -d "jar_name=$jar_name&channel=$channel&release_tag=$tag&sha256=$jar_sha256&time=$ctime&changes=\"$changes\""
"
curl --location --request POST "https://api.luminolmc.com/v2/projects/$project_id/$mcversion/build/commit" -H "Content-Type: application/json" -H "Authorization: $secret_v2" -d "jar_name=$jar_name&channel=$channel&release_tag=$tag&sha256=$jar_sha256&time=$ctime&changes=\"$changes\""