File: validate_tag.sh

package info (click to toggle)
node-mapnik 3.7.2%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 15,376 kB
  • sloc: cpp: 16,551; xml: 961; sh: 522; makefile: 80; lisp: 10
file content (24 lines) | stat: -rwxr-xr-x 967 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash

set -u

# let's catch the case where we tag but
# forget to increment the package.json version

# check if we are on a tag
if [ `git describe --tags --always HEAD` ]; then
    echo 'looks like we are on a tag'
    if [[ $TRAVIS_BRANCH == `git describe --tags --always HEAD` ]]; then
        echo 'git reports the same tag as travis'
        # now check to make sure package.json `version` matches
        MODULE_VERSION=$(node -e "console.log(require('./package.json').version)")
        if [[ $MODULE_VERSION != $TRAVIS_BRANCH ]] && [[ v$MODULE_VERSION != $TRAVIS_BRANCH ]]; then
            echo "package.json version ($MODULE_VERSION) does not match tag ($TRAVIS_BRANCH)"
            exit 1
        else
            echo "Validation success: package.json ($MODULE_VERSION) matches tag ($TRAVIS_BRANCH)"
        fi
    else
        echo "warning: travis thinks the tag ($TRAVIS_BRANCH) differs from git (`git describe --tags --always HEAD`)"
    fi
fi