#!/usr/bin/env bash

set -ueo pipefail

first="$(head -1 debian/changelog)"

if ! grep -qE '^[^(]+ \([^)]+\) ' <<< "$first"; then
    echo 'Unable to find version in debian/changelog' 1>&2
    exit 2
fi

ver="${first#* (}" # remove everything before the version
ver="${ver%%) *}" # remove everything after the version
echo "$ver"
