diff --git a/operations/invalidate-cdn-cache.sh b/operations/invalidate-cdn-cache.sh new file mode 100755 index 0000000..5dda79e --- /dev/null +++ b/operations/invalidate-cdn-cache.sh @@ -0,0 +1,28 @@ +#!/bin/bash +echo "Looking up CloudFront distribution ID for HFF Entry Forms ${TARGET_ENV} environment." +cloudfront_distribution_id=$(\ + aws cloudfront list-distributions \ + --query "DistributionList.Items[?starts_with(Comment, 'HFF Entry Forms ${TARGET_ENV}')].Id | [0]" \ + | sed -e 's/^"//' -e 's/"$//' +) + +if [[ -z "${cloudfront_distribution_id}" ]]; then + >&2 echo "Unable to find CloudFront distribution for domain ${TARGET_ENV}." + exit 3 +fi + +echo "Found distribution ID ${cloudfront_distribution_id}." + +echo "Invalidating the CloudFront cache for ${TARGET_ENV}." +invalidation_id=$(aws cloudfront create-invalidation \ + --query 'Invalidation.Id' \ + --distribution-id "${cloudfront_distribution_id}" \ + --paths '/index.html') + +if [[ $? -ne 0 || -z "${invalidation_id}" ]]; then + >&2 echo "Unable to create the CloudFront invalidation." +else + echo "Successfully created invalidation ${invalidation_id}." +fi + +echo "Done." diff --git a/operations/update-version.sh b/operations/update-version.sh index 3dd7a66..4e95a39 100755 --- a/operations/update-version.sh +++ b/operations/update-version.sh @@ -53,7 +53,7 @@ sed -i "s/${lastVersion}/${newVersion}/" api/hff_entry_forms_api.nimble printf ">> Committing new version.\n" printf "git add web/package.json web/package-lock.json api/src/hff_entry_forms_apipkg/version.nim" -git add web/package.json web/package-lock.json api/src/hff_entry_forms_apipkg/version.nimnim api/hff_entry_forms_api.nimble +git add web/package.json web/package-lock.json api/src/hff_entry_forms_apipkg/version.nim api/hff_entry_forms_api.nimble printf "git commit -m \"Update package version to %s\"\n" "$newVersion" git commit -m "Update package version to ${newVersion}" diff --git a/web/.env.development b/web/.env.development new file mode 100644 index 0000000..a80f97d --- /dev/null +++ b/web/.env.development @@ -0,0 +1,2 @@ +NODE_ENV=production +VUE_APP_API_BASE_URL=https://forms-api-dev.hopefamilyfellowship.com/v1/ diff --git a/web/package.json b/web/package.json index aea4be2..7a6aa40 100644 --- a/web/package.json +++ b/web/package.json @@ -5,7 +5,8 @@ "scripts": { "serve": "npx servor dist", "build": "vue-cli-service build", - "build-local": "vue-cli-service build --mode development", + "build-dev": "vue-cli-service build --mode development", + "build-prod": "vue-cli-service build --mode production", "lint": "vue-cli-service lint", "vue-serve": "vue-cli-service serve" },