Skip to content

Commit

Permalink
Added scripts for latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasdille committed Jan 28, 2025
1 parent 55aea2c commit 51930fe
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tools/papermc/latest.runn.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
desc: Get latest version
runners:
req: https://api.papermc.io/v2
vars:
project: paper
steps:

getLatestVersionGroup:
desc: Get latest version group
req:
/projects/{{ vars.project }}:
get: {}
test: |
steps.getLatestVersionGroup.res.status == 200
bind:
versionGroup: steps.getLatestVersionGroup.res.body.version_groups[-1]

getLatestBuildForVersionGroup:
desc: Get latest build for version group
req:
/projects/{{ vars.project }}/version_group/{{ versionGroup }}/builds:
get: {}
test: |
steps.getLatestBuildForVersionGroup.res.status == 200
bind:
latestBuild: filter(steps.getLatestBuildForVersionGroup.res.body.builds, {.channel == "default"})[-1]

dumpLatestBuild:
dump: (latestBuild.version + "-" + string(latestBuild.build))
7 changes: 7 additions & 0 deletions tools/papermc/latest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

curl --silent --show-error --location --fail "https://api.papermc.io/v2/projects/paper" \
| jq --raw-output '.version_groups[-1]' \
| xargs -I{} \
curl --silent --show-error --location --fail "https://api.papermc.io/v2/projects/paper/version_group/{}/builds" \
| jq --raw-output '.builds | map(select(.channel == "default")) | .[-1] | "\(.version)-\(.build)"'

0 comments on commit 51930fe

Please sign in to comment.