mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
Add API v2
This commit is contained in:
1
.github/workflows/leaves.yml
vendored
1
.github/workflows/leaves.yml
vendored
@@ -76,5 +76,6 @@ jobs:
|
||||
if: "!contains(github.event.commits[0].message, '[release-skip]')"
|
||||
env:
|
||||
secret: ${{ secrets.API_PUSH_TOKEN }}
|
||||
secret_v2: ${{ secrets.API_V2_PUSH_TOKEN }}
|
||||
tag: ${{ env.tag }}
|
||||
run: sh scripts/PushToAPI.sh
|
||||
|
||||
@@ -23,4 +23,9 @@ changes=$(git log --pretty='%H<<<%s>>>' -"$number" | sed ':a;N;$!ba;s/\n//g')
|
||||
jar_name="leaves-$mcversion.jar"
|
||||
jar_sha256=`sha256 $jar_name`
|
||||
|
||||
# v1
|
||||
curl --location --request POST "https://api.leavesmc.top/new_release" --header "Content-Type: application/json" --data-raw "{\"project_id\":\"$project_id\",\"project_name\":\"$project_name\",\"version\":\"$mcversion\",\"time\":\"$ctime\",\"channel\":\"$channel\",\"promoted\":$promoted,\"changes\":\"$changes\",\"downloads\":{\"application\":{\"name\":\"$jar_name\",\"sha256\":\"$jar_sha256\",\"url\":\"https://github.com/LeavesMC/Leaves/releases/download/$tag/$jar_name\"}},\"secret\":\"$secret\"}"
|
||||
curl --location --request POST "https://api.leavesmc.top/upload_file" -F "file=@$jar_name" -F "filename=$jar_name" -F "filehash=$jar_sha256" -F "secret=$secret"
|
||||
|
||||
# v2
|
||||
curl --location --request POST "https://api.leavesmc.top/v2/commit/build" --header "Content-Type: application/json" --header "Authentication: Bearer $secret_v2" --data-raw "{\"project_id\":\"$project_id\",\"version\":\"$mcversion\",\"channel\":\"$channel\",\"changes\":\"$changes\",\"jar_name\":\"$jar_name\",\"sha256\":\"$jar_sha256\",\"tag\":\"$tag\"}"
|
||||
Reference in New Issue
Block a user