diff --git a/.github/workflows/leaves.yml b/.github/workflows/leaves.yml index 6a818d39..b7f4beed 100644 --- a/.github/workflows/leaves.yml +++ b/.github/workflows/leaves.yml @@ -72,3 +72,9 @@ jobs: with: name: ${{ env.jar }} path: ${{ env.jar }} + - name: Push to Api + if: "!contains(github.event.commits[0].message, '[release-skip]')" + env: + secret: ${{ secrets.API_PUSH_TOKEN }} + tag: ${{ env.tag }} + run: sh scripts/push_to_api.sh diff --git a/scripts/PushToAPI.sh b/scripts/PushToAPI.sh new file mode 100644 index 00000000..2d4f0671 --- /dev/null +++ b/scripts/PushToAPI.sh @@ -0,0 +1,47 @@ +sha256() { + sha256sum $1 | awk '{print $1}' +} + +prop() { + grep "${1}" gradle.properties | cut -d'=' -f2 | sed 's/\r//' +} +echo "$tag" +project_id="leaves" +project_name="leaves" +mcversion=$(prop mcVersion) +ctime=$(date -u +"%Y-%m-%dT%H:%M:%SZ") +pre=$(prop preVersion) +if [ $pre = "true" ]; then + channel="experimental" +else + channel="default" +fi +promoted=false + +number=$(git log --oneline master ^`git describe --tags --abbrev=0` | wc -l) +changes=$(echo "(git log --pretty='%H<<<%s>>>' -number)" | sed 's/\\n/\\\\n/g') +jar_name="leaves-$mcversion.jar" +jar_sha256=`sha256 $jar_name` + +data=$(cat <