* Add tiny Bash wrapper to check for Node before attempting to execute Heroku release script * Use the wrapper script for the Heroku release command * Be explicit about exiting with Node's exit code * If Node is missing, exit using that script's exit code
32 lines
906 B
Bash
Executable File
32 lines
906 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# [start-readme]
|
|
#
|
|
# Light Bash wrapper for the Heroku release command, which sometimes fails
|
|
# unexpectedly in staging environments when a Node installation is missing
|
|
#
|
|
# [end-readme]
|
|
|
|
# Check for node but don't fail immediately if it's not present
|
|
./script/check-for-node
|
|
EXIT_STATUS=$?
|
|
|
|
# If node is missing...
|
|
if [[ "$EXIT_STATUS" -ne "0" ]]; then
|
|
# Fail hard if this is our Heroku production app or if Redis is configured
|
|
if [[ "$HEROKU_PRODUCTION_APP" == "true" || -n "$REDIS_URL" ]]; then
|
|
echo "Error: cannot execute the release script without Node.js, which is fatal."
|
|
echo "Exiting..."
|
|
exit $EXIT_STATUS
|
|
# Otherwise succeed with only a warning
|
|
else
|
|
echo "Warning: although Node.js is missing, it is non-critical."
|
|
echo "Exiting..."
|
|
exit 0
|
|
fi
|
|
fi
|
|
|
|
# Execute the release script and exit with its status
|
|
node script/purge-redis-pages.js
|
|
exit $?
|