File: validate_tag.sh

package info (click to toggle)
node-sqlite3 4.0.6%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,268 kB
  • sloc: sql: 10,062; cpp: 1,878; sh: 245; makefile: 74; python: 8
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