From 56d9d98ae14beec59bbb37d803cddcc0c81d90b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ciornavei?= Date: Thu, 7 Mar 2024 21:56:13 -0300 Subject: [PATCH 1/2] attempt to adjust env vars to be readable --- .github/workflows/workflow.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index c153b72..02f7f62 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -102,23 +102,24 @@ jobs: run: | cd frontend rm -rf .env - echo "REACT_APP_API_URL=https://$SUBDOMAIN-api.$([ "$BRANCH" != "production" ] && echo "$BRANCH.")$DOMAIN" >> .env + echo "REACT_APP_API_URL=https://$SUBDOMAIN-api.$([ "${BRANCH}" != "production" ] && echo "${BRANCH}.")${DOMAIN}" >> .env yarn --dev --production=false yarn build if: success() - # This step deploys your application to AWS Lambda using the Serverless Framework. - - name: Deploy to AWS Lambda + # This step deploys the application resources to AWS using the Serverless Framework. + - name: Deploy resources to AWS with Serverless Framework run: | cd frontend rm -rf .env - echo "DOMAIN=$DOMAIN" >> .env - echo "AWS_HOSTED_ZONE_ID=$AWS_HOSTED_ZONE_ID" >> .env - serverless deploy --config serverless-cert.yml --stage $BRANCH --region $AWS_DEFAULT_REGION --verbose + echo "DOMAIN=${DOMAIN}" >> .env + echo "AWS_HOSTED_ZONE_ID=${AWS_HOSTED_ZONE_ID}" >> .env + cat .env + serverless deploy --config serverless-cert.yml --stage ${BRANCH} --region ${AWS_DEFAULT_REGION} --verbose SLS_WEBCERT_OUTPUT=$(cat sls-webcert-output.json) - $(echo "$SLS_WEBCERT_OUTPUT" | jq -r 'keys[] as $k | "export \($k)=\(.[$k])"') + $(echo "${SLS_WEBCERT_OUTPUT}" | jq -r 'keys[] as $k | "export \($k)=\(.[$k])"') echo "AWS_ACM_ARN=${CertificateDomainArn}" >> .env - serverless deploy --config serverless.yml --stage $BRANCH --region $AWS_DEFAULT_REGION --verbose + serverless deploy --config serverless.yml --stage ${BRANCH} --region ${AWS_DEFAULT_REGION} --verbose if: success() # This step deploys your application to AWS Lambda using the Serverless Framework. From 16d02b9add6e268f5f3f61d7df91ae3f384000ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ciornavei?= Date: Thu, 7 Mar 2024 21:57:04 -0300 Subject: [PATCH 2/2] attempt to adjust env vars to be readable --- .github/workflows/workflow.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 02f7f62..78f8144 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -126,9 +126,9 @@ jobs: - name: Release application aws s3 and invalidate cloud formation cache run: | cd frontend - S3_DOMAIN="$APP_NAME.$([ "$BRANCH" != "production" ] && echo "$BRANCH.")${{ vars.DOMAIN }}" - aws s3 sync build/ s3://$S3_DOMAIN + S3_DOMAIN="$APP_NAME.$([ "${BRANCH}" != "production" ] && echo "${BRANCH}.")${DOMAIN}" + aws s3 sync build/ s3://${S3_DOMAIN} SLS_OUTPUT=$(cat sls-output.json) - $(echo "$SLS_OUTPUT" | jq -r 'keys[] as $k | "export \($k)=\(.[$k])"') - aws cloudfront create-invalidation --distribution-id $CDNDistributionId --paths "/*" + $(echo "${SLS_OUTPUT}" | jq -r 'keys[] as $k | "export \($k)=\(.[$k])"') + aws cloudfront create-invalidation --distribution-id ${CDNDistributionId} --paths "/*" if: success()