#!/usr/bin/env bash

errors=()

if [ -z "${PYPI_TOKEN:-}" ]; then
  errors+=("The PYPI_TOKEN secret has not been set. Configure it as a repository or organization Actions secret with publish access to the fireworks-ai PyPI project.")
fi

lenErrors=${#errors[@]}

if [[ lenErrors -gt 0 ]]; then
  echo -e "Found the following errors in the release environment:\n"

  for error in "${errors[@]}"; do
    echo -e "- $error\n"
  done

  exit 1
fi

echo "The environment is ready to push releases!"
