#!/usr/bin/env bash

set -x 
set -e

REPO=$1
mkdir -p tmp/$REPO

pushd tmp/$REPO

curl -Lsf "https://api.github.com/repos/$REPO/releases/latest" > latest.json
jq --exit-status -re ".tag_name" > .version < latest.json

popd

[ -s tmp/$REPO/.version ]
