Skip to content

Commit

Permalink
fix double amplifyPush
Browse files Browse the repository at this point in the history
the logic as written will run the init command twice if it returns a non-zero exit code for any reason.

see https://github.com/koalaman/shellcheck/wiki/SC2015
  • Loading branch information
joekiller committed May 24, 2023
1 parent 6d9c738 commit 167a4df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/amplifyPush.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ init_env () {
if [[ -z ${STACKINFO} ]];
then
echo "# Initializing new Amplify environment: ${ENV} (amplify init)"
[[ -z ${CATEGORIES} ]] && amplify init --amplify ${AMPLIFY} --providers ${PROVIDERS} --codegen ${CODEGEN} --yes --forcePush || amplify init --amplify ${AMPLIFY} --providers ${PROVIDERS} --codegen ${CODEGEN} --categories ${CATEGORIES} --yes --forcePush
if [[ -z ${CATEGORIES} ]]; then amplify init --amplify ${AMPLIFY} --providers ${PROVIDERS} --codegen ${CODEGEN} --yes --forcePush; else amplify init --amplify ${AMPLIFY} --providers ${PROVIDERS} --codegen ${CODEGEN} --categories ${CATEGORIES} --yes --forcePush; fi
echo "# Environment ${ENV} details:"
amplify env get --name ${ENV}
else
echo "STACKINFO="${STACKINFO}
echo "# Importing Amplify environment: ${ENV} (amplify env import)"
amplify env import --name ${ENV} --config "${STACKINFO}" --awsInfo ${AWSCONFIG} --yes;
echo "# Initializing existing Amplify environment: ${ENV} (amplify init)"
[[ -z ${CATEGORIES} ]] && amplify init --amplify ${AMPLIFY} --providers ${PROVIDERS} --codegen ${CODEGEN} --yes --forcePush || amplify init --amplify ${AMPLIFY} --providers ${PROVIDERS} --codegen ${CODEGEN} --categories ${CATEGORIES} --yes --forcePush
if [[ -z ${CATEGORIES} ]]; then amplify init --amplify ${AMPLIFY} --providers ${PROVIDERS} --codegen ${CODEGEN} --yes --forcePush; else amplify init --amplify ${AMPLIFY} --providers ${PROVIDERS} --codegen ${CODEGEN} --categories ${CATEGORIES} --yes --forcePush; fi
echo "# Environment ${ENV} details:"
amplify env get --name ${ENV}
fi
Expand Down

0 comments on commit 167a4df

Please sign in to comment.