#!/bin/bash
set -eu

# Script to get version for Workers apps

if ! command -v jq >/dev/null; then
	echo "ERROR: jq is required for getting the version of the Worker from package.json. Please install jq."
	exit 1
fi

pkg_json_version=$(jq -r '.version' package.json)
gitsha=$(git log -1 --pretty=format:%h)

echo "$pkg_json_version-$gitsha"
