Skip to content

Commit

Permalink
Merge pull request #55 from andreciornavei/develop
Browse files Browse the repository at this point in the history
improve ci
  • Loading branch information
andreciornavei authored Mar 8, 2024
2 parents 73326b2 + 16d02b9 commit b364dd1
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,32 +102,33 @@ 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.
- 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()

0 comments on commit b364dd1

Please sign in to comment.