#!/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 else # Execute the release script and exit with its status node script/purge-redis-pages.js exit $? fi