Dynamic modrinth version fetching
Some checks failed
Deploy Jekyll site to Pages / build (push) Failing after 33s

This commit is contained in:
2025-01-11 11:29:58 +01:00
parent 78410cfa4b
commit a0988516d4
6 changed files with 42 additions and 10 deletions

View File

@@ -28,6 +28,38 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y jq curl sed
- name: Fetch Latest Modrinth Version
id: fetch_version
run: |
# Modrinth API Call
response=$(curl -s -H "Authorization: Bearer $MODRINTH_TOKEN" https://api.modrinth.com/v2/project/illuvia-prime-project/version)
# Extract latest release version
latest_release=$(echo "$response" | jq -cr '[.[] | select(.status == "listed" and .version_type == "release")] | sort_by(.date_published) | last'
if [ -z "$latest_release" ]; then
echo "No release version found"
exit 1
fi
# Extract version_number and game_versions
version_number=$(echo "$latest_release" | jq -r '.version_number')
game_version=$(echo "$latest_release" | jq -r '.game_versions[0]')
echo "Latest version: $version_number (Minecraft $game_version)"
# Output for next steps
echo "PACK_VERSION=$version_number" >> $GITHUB_ENV
echo "MINECRAFT_VERSION=$game_version" >> $GITHUB_ENV
- name: Update _config.yml
run: |
# Replace placeholders in _config.yml
sed -i "s/PACK_VERSION/$PACK_VERSION/g" _config.yml
sed -i "s/MINECRAFT_VERSION/$MINECRAFT_VERSION/g" _config.yml
- name: checkout pages
uses: actions/checkout@v4
with: