Switch from commit message publishing to tag-based publishing

This commit is contained in:
Patrick Niklaus
2017-03-29 15:20:07 +00:00
committed by Patrick Niklaus
parent 927dea37bb
commit fc84f605af
3 changed files with 28 additions and 47 deletions
+21 -46
View File
@@ -3,56 +3,31 @@
set -eu
set -o pipefail
# should be set for debug builds
export NPM_FLAGS=${NPM_FLAGS:-}
if [[ ${PUBLISH} == 'On' ]]; then
echo "PUBLISH is set to '${PUBLISH}', publishing!"
echo "node version is:"
which node
node -v
echo "node version is:"
which node
node -v
echo "dumping binary meta..."
./node_modules/.bin/node-pre-gyp reveal ${NPM_FLAGS}
echo "dumping binary meta..."
./node_modules/.bin/node-pre-gyp reveal
# enforce that binary has proper ORIGIN flags so that
# it can portably find libtbb.so in the same directory
if [[ $(uname -s) == 'Linux' ]]; then
readelf -d ./lib/binding/node-osrm.node > readelf-output.txt
if grep -q 'Flags: ORIGIN' readelf-output.txt; then
echo "Found ORIGIN flag in readelf output"
cat readelf-output.txt
else
echo "*** Error: Could not found ORIGIN flag in readelf output"
cat readelf-output.txt
exit 1
# enforce that binary has proper ORIGIN flags so that
# it can portably find libtbb.so in the same directory
if [[ $(uname -s) == 'Linux' ]]; then
readelf -d ./lib/binding/node-osrm.node > readelf-output.txt
if grep -q 'Flags: ORIGIN' readelf-output.txt; then
echo "Found ORIGIN flag in readelf output"
cat readelf-output.txt
else
echo "*** Error: Could not found ORIGIN flag in readelf output"
cat readelf-output.txt
exit 1
fi
fi
fi
echo "determining publishing status..."
export COMMIT_MESSAGE=$(git log --format=%B --no-merges | head -n 1 | tr -d '\n')
echo "Commit message: ${COMMIT_MESSAGE}"
if [[ $(./scripts/travis/is_pr_merge.sh) ]]; then
if [[ ${COMMIT_MESSAGE} =~ "[force publish binary]" ]]; then
echo "Publishing because it's forced"
./node_modules/.bin/node-pre-gyp package ${NPM_FLAGS}
./node_modules/.bin/node-pre-gyp publish ${NPM_FLAGS}
else
echo "Skipping publishing because this is a PR merge commit"
fi
./node_modules/.bin/node-pre-gyp package publish info
else
echo "This is a push commit, continuing to package..."
./node_modules/.bin/node-pre-gyp package ${NPM_FLAGS}
if [[ ${COMMIT_MESSAGE} =~ "[publish binary]" ]]; then
echo "Publishing"
./node_modules/.bin/node-pre-gyp package ${NPM_FLAGS}
./node_modules/.bin/node-pre-gyp publish ${NPM_FLAGS}
elif [[ ${COMMIT_MESSAGE} =~ "[republish binary]" ]]; then
echo "*** Error: Republishing is disallowed for this repository"
exit 1
#./node_modules/.bin/node-pre-gyp unpublish publish ${NPM_FLAGS}
else
echo "Skipping publishing"
fi;
echo "PUBLISH is set to '${PUBLISH}', skipping."
fi