summaryrefslogtreecommitdiff
path: root/scripts/node/after_script.sh
blob: d78e820e92471c42881ddc13cfc38ca466935d32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash

set -e
set -o pipefail

# Inspect binary.
if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
    ldd ./lib/mapbox-gl-native.node
else
    otool -L ./lib/mapbox-gl-native.node
fi

COMMIT_MESSAGE=$(git show -s --format=%B $TRAVIS_COMMIT | tr -d '\n')

if test "${COMMIT_MESSAGE#*'[publish binary]'}" != "$COMMIT_MESSAGE"; then
    source ~/.nvm/nvm.sh
    nvm use $NODE_VERSION

    npm install aws-sdk

    ./node_modules/.bin/node-pre-gyp package

    if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
        ./node_modules/.bin/node-pre-gyp testpackage
    fi

    ./node_modules/.bin/node-pre-gyp publish info

    if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
        source ./scripts/${TRAVIS_OS_NAME}/setup.sh

        rm -rf build
        rm -rf lib
        npm install --fallback-to-build=false
        npm test
    fi
fi