Minor updates to Makefile to better support multiple environment targets.

This commit is contained in:
Jonathan Bernard 2021-11-16 07:04:31 -06:00
parent 219796f9e2
commit 955f83b8ad
5 changed files with 14 additions and 13 deletions

View File

@ -1,11 +1,10 @@
VERSION:=$(shell git describe --always) VERSION:=$(shell git describe --always)
TARGET_ENV ?= dev TARGET_ENV ?= dev
build: dist/hff-entry-forms-api.tar.gz dist/hff-entry-forms-web.tar.gz build: api-image dist/hff-entry-forms-web.${TARGET_ENV}.tar.gz
clean: clean:
-rm -r dist -rm -r dist
-rm -r web/dist
make -C api clean make -C api clean
make -C web clean make -C web clean
@ -15,20 +14,22 @@ test:
update-version: update-version:
operations/update-version.sh operations/update-version.sh
dist/hff-entry-forms-web.tar.gz: api-image:
make -C api build-image
dist/hff-entry-forms-web-${VERSION}.${TARGET_ENV}.tar.gz:
-mkdir dist -mkdir dist
TARGET_ENV=$(TARGET_ENV) make -C web build TARGET_ENV=${TARGET_ENV} make -C web build
tar czf dist/hff-entry-forms-web-${VERSION}.tar.gz -C web/dist . tar czf dist/hff-entry-forms-web-${VERSION}.${TARGET_ENV}.tar.gz -C web/dist .
cp dist/hff-entry-forms-web-${VERSION}.tar.gz dist/hff-entry-forms-web.tar.gz
deploy-api: deploy-api:
make -C api build-image push-image make -C api build-image push-image
cd operations/terraform && terraform apply -target module.${TARGET_ENV}_env.aws_ecs_task_definition.hff_entry_forms_api -target module.${TARGET_ENV}_env.aws_ecs_service.hff_entry_forms_api cd operations/terraform && terraform apply -target module.${TARGET_ENV}_env.aws_ecs_task_definition.hff_entry_forms_api -target module.${TARGET_ENV}_env.aws_ecs_service.hff_entry_forms_api
deploy-web: dist/hff-entry-forms-web.tar.gz deploy-web: dist/hff-entry-forms-web-${VERSION}.${TARGET_ENV}.tar.gz
mkdir -p temp-deploy/hff-entry-forms-web-${VERSION} mkdir -p temp-deploy/hff-entry-forms-web-${VERSION}
tar xzf dist/hff-entry-forms-web-${VERSION}.tar.gz -C temp-deploy/hff-entry-forms-web-${VERSION} tar xzf dist/hff-entry-forms-web-${VERSION}.${TARGET_ENV}.tar.gz -C temp-deploy/hff-entry-forms-web-${VERSION}
aws s3 sync temp-deploy/hff-entry-forms-web-${VERSION} s3://forms.hopefamilyfellowship.com/$(TARGET_ENV)/webroot aws s3 sync temp-deploy/hff-entry-forms-web-${VERSION} s3://forms.hopefamilyfellowship.com/${TARGET_ENV}/webroot
TARGET_ENV=${TARGET_ENV} operations/invalidate-cdn-cache.sh TARGET_ENV=${TARGET_ENV} operations/invalidate-cdn-cache.sh
rm -r temp-deploy rm -r temp-deploy

View File

@ -1,6 +1,6 @@
# Package # Package
version = "0.3.0" version = "0.3.1"
author = "Jonathan Bernard" author = "Jonathan Bernard"
description = "Hope Family Fellowship entry forms." description = "Hope Family Fellowship entry forms."
license = "GPL-3.0-or-later" license = "GPL-3.0-or-later"

View File

@ -1 +1 @@
const HFF_ENTRY_FORMS_API_VERSION* = "0.3.0" const HFF_ENTRY_FORMS_API_VERSION* = "0.3.1"

2
web/package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "hff-entry-form-web", "name": "hff-entry-form-web",
"version": "0.3.0", "version": "0.3.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "hff-entry-form-web", "name": "hff-entry-form-web",
"version": "0.3.0", "version": "0.3.1",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "npx servor dist", "serve": "npx servor dist",