I found an incredibly roundabout way of doing this.
./compile.sh \
kernel \
BOARD=$OPT_ARMBIAN_BOARD \
BRANCH=$OPT_ARMBIAN_KERNEL \
CLEAN_LEVEL=make,alldebs,images,cache \
EXPERT=yes \
PREFER_DOCKER=yes \
KERNEL_GIT=shallow
KERNEL_CONFIG=$(find $KERNEL_DIR/cache/sources/linux-kernel-worktree -name .config)
if [ ! -f $KERNEL_CONFIG ]
then
echo "Failed to find .config"
exit 1
fi
FULL_KERNEL_VERSION=$(cat $KERNEL_CONFIG | grep "Kernel Configuration" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
if [ "$FULL_KERNEL_VERSION" == "" ]
then
echo "Failed to get full kernel version."
exit 1
fi