Skip to content

Commit

Permalink
Provided convenient manual deployment method.
Browse files Browse the repository at this point in the history
  • Loading branch information
grosscol committed Jun 20, 2023
1 parent 29f524b commit 26e452d
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions scripts/push_to_s3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

# Script to facilitate manually deploying UI to staging or production.
# Expected to be run after either `npm run build` or `npm run build_staging`.
# Copies files from dist/ directory to S3 bucket backing cloudfront dist.

# Get BUCKET_NAME from terraform output of bravo infrastructure provisioning.
PROFILE="${PROFILE:=statgen}"
BUCKET_NAME="$1"
S3BUCKET="s3://${BUCKET_NAME}"

if [ -z "$1" ]
then
echo "Need to supply BUCKET_NAME as first argument"
echo "Expectect usage:"
echo " ./push_to_s3.sh example_pet_vue_site"
fi

# Push all files to bucket
aws --profile ${PROFILE} s3 cp --recursive dist/ ${S3BUCKET}

# The following was to update the metadata for endpoints without .html
# Is required if building an app that doesn't have .html on the endpoints.
# e.g. dist/variant instead of dist/variant.html
# Push files without extension and add metadata to inform content type
# Required to be served out of CDN as html.

# for file in `fdfind -d 1 -t file -E '*.*' '.*' dist/`
# do
# aws --profile ${PROFILE} s3 cp ${file} ${S3BUCKET} --content-type "text/html"
# done

0 comments on commit 26e452d

Please sign in to comment.