summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Morris <michael.patrick.morris@gmail.com>2015-11-05 12:40:58 -0500
committerMike Morris <michael.patrick.morris@gmail.com>2015-11-05 14:45:34 -0500
commit3a91686a099533de85b47ca42b7f97035f8d4a82 (patch)
tree85ab3091b7c7df414769de3c69e3298daf747757
parentbe16c37e651a33a1ae07aab582a3e07f98a5ddfc (diff)
downloadqtlocation-mapboxgl-3a91686a099533de85b47ca42b7f97035f8d4a82.tar.gz
[node] autopublish node-pre-gyp binary
If $TRAVIS_TAG matches with node-v${PACKAGE_JSON_VERSION}.
-rw-r--r--package.json1
-rwxr-xr-xscripts/node/after_script.sh3
-rw-r--r--scripts/node/package-version.js6
3 files changed, 9 insertions, 1 deletions
diff --git a/package.json b/package.json
index 60540e9a60..97875af2ef 100644
--- a/package.json
+++ b/package.json
@@ -27,6 +27,7 @@
"devDependencies": {
"aws-sdk": "^2.2.9",
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#744b63be01e36c75c6e629aec16a53048c0b7dbc",
+ "read-package-json": "^2.0.2",
"request": "^2.65.0",
"tape": "^4.2.1"
},
diff --git a/scripts/node/after_script.sh b/scripts/node/after_script.sh
index c56b7af18d..849505e7aa 100755
--- a/scripts/node/after_script.sh
+++ b/scripts/node/after_script.sh
@@ -11,8 +11,9 @@ else
fi
COMMIT_MESSAGE=$(git show -s --format=%B $TRAVIS_COMMIT | tr -d '\n')
+PACKAGE_JSON_VERSION=$(node ./scripts/node/package-version.js)
-if test "${COMMIT_MESSAGE#*'[publish binary]'}" != "$COMMIT_MESSAGE"; then
+if [[ ${TRAVIS_TAG} == node-v${PACKAGE_JSON_VERSION} ]] || test "${COMMIT_MESSAGE#*'[publish binary]'}" != "$COMMIT_MESSAGE"; then
source ~/.nvm/nvm.sh
nvm use $NODE_VERSION
diff --git a/scripts/node/package-version.js b/scripts/node/package-version.js
new file mode 100644
index 0000000000..99b56aee44
--- /dev/null
+++ b/scripts/node/package-version.js
@@ -0,0 +1,6 @@
+var readJSON = require('read-package-json');
+
+readJSON('package.json', function(err, data) {
+ if (err) process.stderr.write(err);
+ process.stdout.write(data.version);
+});