validate-version

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