validate-version

 1#!/bin/bash
 2
 3set -e
 4
 5if [[ ! -f vendor/bin/jq ]]; then
 6    curl -L https://github.com/stedolan/jq/releases/download/jq-1.6/jq-osx-amd64 > vendor/bin/jq
 7    chmod +x vendor/bin/jq
 8fi
 9
10package_version="v$(cargo metadata --format-version=1 | vendor/bin/jq --raw-output '.packages[] | select(.name == "zed") | .version')"
11git_tag=$(git tag --points-at HEAD)
12
13if [[ $package_version != $git_tag ]]; then
14    echo "Version $package_version of zed package does not match git tag $git_tag"
15    exit 1
16fi