From 2cd8534d6f69e105ff676e2fdb248649408b5ca6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ole=20Volds=C3=A6ter?= <ole.voldsater@uib.no>
Date: Thu, 13 Feb 2020 10:06:42 +0100
Subject: [PATCH] tester oppdatering av stack + opplasting av build

---
 .aws/config    |  3 +++
 .gitlab-ci.yml | 20 ++++++++++++++++++++
 2 files changed, 23 insertions(+)
 create mode 100644 .aws/config

diff --git a/.aws/config b/.aws/config
new file mode 100644
index 00000000..595f6bdd
--- /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 f3b91f1b..fa7e3d52 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
-- 
GitLab