From 9793aa9d3c72592f2537326764d8d6443f22afc6 Mon Sep 17 00:00:00 2001
From: plup <plup@plup.io>
Date: Tue, 14 Jan 2020 21:36:26 +0100
Subject: [PATCH] cicd: cherry-picked and updated gitlab-ci

---
 .gitlab-ci.yml | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 89 insertions(+)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 00000000..91cd788a
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,89 @@
+image: node
+
+stages:
+ - Validate features
+ - Prepare release
+ - Validate release
+ - Deploy production
+
+## TESTING ##
+
+## VALIDATION ##
+
+deploy_features:
+  stage: Validate features
+  environment:
+    name: integration
+    url: https://integration.startinblox.com
+  script:
+    - echo 'Environment is not setup yet...'
+  only:
+    - feature/*
+  when: manual
+  tags:
+    - sib
+
+deploy_staging:
+  stage: Prepare release
+  environment:
+    name: staging
+    url: https://staging.startinblox.com
+  script:
+    - echo "$APP_CONFIG_PARIS_STG" > config.json
+    - echo "$SSH_PRIVATE_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key
+    - npm install
+    - npm run build
+    - scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* test-paris@ssh-test-paris.happy-dev.fr:~/staging/www/
+  only:
+    - dev
+  when: manual
+  tags:
+    - sib
+
+deploy_preprod:
+  stage: Validate release
+  environment:
+    name: preproduction
+    url: https://preproduction.startinblox.com
+  script:
+    - echo 'Environment is not setup yet...'
+  only:
+    - master
+  tags:
+    - sib
+
+## LIVE DEPLOYMENT ##
+
+deploy_nantes:
+  stage: Deploy production
+  environment:
+    name: nantes
+    url: https://nantes.happy-dev.fr
+  script:
+    - echo "$APP_CONFIG_NANTES" > config.json
+    - echo "$SSH_PRIVATE_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key
+    - npm install
+    - npm run build
+    - scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* test-paris@ssh-test-paris.happy-dev.fr:~/staging/www/
+  only:
+    - master
+  when: manual
+  tags:
+    - sib
+
+deploy_paris:
+  stage: Deploy Production
+  environment:
+    name: paris
+    url: https://paris.happy-dev.fr
+  script:
+    - echo "$APP_CONFIG_PARIS" > config.json
+    - echo "$SSH_PRIVATE_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key
+    - npm install
+    - npm run build
+    - scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* test-paris@ssh-test-paris.happy-dev.fr:~/www/
+  only:
+    - master
+  when: manual
+  tags:
+    - sib
-- 
GitLab