From fabaeb76e056ae81aa6adff125ca5d9f04161e79 Mon Sep 17 00:00:00 2001
From: Rolf Aas <rolf.aas@ibooking.no>
Date: Tue, 2 Mar 2021 19:24:12 +0000
Subject: [PATCH] Deploy to stage from develop

---
 .gitlab-ci.yml | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1f0bf59..f8ea0b7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,6 +9,9 @@ stages:
 
 build-job:
   stage: build
+  only:
+    - develop
+    - master
   script:
     - echo "Running build"
     - cd backend/secfit
@@ -18,6 +21,9 @@ build-job:
 
 test-backend:
   stage: test
+  only:
+    - develop
+    - master
   script:
     - echo "Running Django tests on backend"
     - cd backend/secfit
@@ -28,21 +34,37 @@ test-backend:
 
 test-frontend:
   stage: test
+  only:
+    - develop
+    - master
   script:
     - echo "This is a placeholder for testing the frontend"
 
+deploy-stage:
+  image: ruby:latest
+  only:
+    - develop
+  stage: deploy
+  before_script:
+    - apt-get update -qy
+    - apt-get install -y ruby-dev
+    - gem install dpl
+  script:
+    - echo "Deploying to Heroku stage"
+    - dpl --provider=heroku --app=$HEROKU_FRONTEND_APP_STAGE --api-key=$HEROKU_API_KEY
+    - dpl --provider=heroku --app=$HEROKU_BACKEND_APP_STAGE --api-key=$HEROKU_API_KEY
+
 deploy-prod:
   image: ruby:latest
   only:
     - master
-    - pipeline
   stage: deploy
   before_script:
     - apt-get update -qy
     - apt-get install -y ruby-dev
     - gem install dpl
   script:
-    - echo "Deploying to Heroku"
+    - echo "Deploying to Heroku production"
     - dpl --provider=heroku --app=$HEROKU_FRONTEND_APP_PRODUCTION --api-key=$HEROKU_API_KEY
     - dpl --provider=heroku --app=$HEROKU_BACKEND_APP_PRODUCTION --api-key=$HEROKU_API_KEY
 
-- 
GitLab