#!/usr/bin/env bash

VERSION="$1"
PLATFORM="$2"

TMP_PATH="/tmp/godot"
mkdir -p "$TMP_PATH"

BINARY_NAME="Godot_v${VERSION}_${PLATFORM}"
TMP_PATH="$TMP_PATH/godot_${VERSION}_${PLATFORM}.zip"
ARTIFACT_PATH="https://github.com/godotengine/godot-builds/releases/download/${VERSION}/${BINARY_NAME}.zip"

wget -O "$TMP_PATH" "$ARTIFACT_PATH"
unzip -o "$TMP_PATH" -d "$(pwd)"
mv "$BINARY_NAME" godot