diff --git a/.aws/config b/.aws/config new file mode 100644 index 0000000000000000000000000000000000000000..595f6bddba7d489eccbeb734e9868340ed91664f --- /dev/null +++ b/.aws/config @@ -0,0 +1,3 @@ +[default] +region=eu-west-1 +credential_source = Environment diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f3b91f1bad7969d76e2f9bd6fd54690365645fd7..fa7e3d527b3252fdf1820322957972a940a2f8d7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,3 +12,23 @@ build: expire_in: 1 week paths: - dist + +deploy: + image: uibit/awscli:latest + stage: deploy + script: + - rm -rf ~/.aws + - mv .aws ~/ + - STACK_NAME=ordbok-frontend-beta + - if aws cloudformation describe-stacks --stack-name ${STACK_NAME} &> /dev/null + - then + - echo "stack exists" + - aws cloudformation update-stack --stack-name ${STACK_NAME} --template-body file://aws/api.yaml + - aws cloudformation wait stack-update-complete --stack-name ${STACK_NAME} + - else + - echo "creating stack" + - aws cloudformation create-stack --stack-name ${STACK_NAME} --template-body file://aws/api.yaml + - aws cloudformation wait stack-create-complete --stack-name ${STACK_NAME} + - fi + - aws s3 rm "s3://${STACK_NAME}.aws.uib.no" --recursive + - aws s3 sync dist/ "s3://${STACK_NAME}.aws.uib.no" --delete