-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
78 lines (73 loc) · 1.99 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
stages:
# - dependencies
- cloud_run_deploy
- build_stage
- deploy_stage
cloud_run_deploy:
stage: cloud_run_deploy
image: google/cloud-sdk
services:
- docker:dind
only:
- "main"
script:
- echo $GCP_SERVICE_KEY > gcloud-service-key.json # Google Cloud service accounts
- gcloud auth activate-service-account --key-file gcloud-service-key.json
- gcloud config set project $GCP_PROJECT_ID
- gcloud builds submit . --config=cloudbuild.yml
# Build the frontend on development branch
build_development_frontend:
stage: build_stage
image: node:latest
before_script:
- cd frontend
script:
- echo "Build starting - DEVELOPMENT branch"
- npm i
- npm run build
- echo "Build completed - DEVELOPMENT branch"
only:
- develop
except:
changes:
- frontend/**/*
# Deploy the frontend build of development to Netlify
deploy_development_frontend:
stage: deploy_stage
before_script:
- apt update
- apt install curl -y
script:
- echo "Deployment starting - DEVELOPMENT branch"
- curl -X POST "https://api.netlify.com/build_hooks/${NETLIFY_DEVELOPMENT_ENV_DEPLOY_KEY}"
- echo "Deployment completed - DEVELOPMENT branch"
only:
- develop
# Build the frontend on production branch
build_production_frontend:
stage: build_stage
image: node:latest
before_script:
- cd frontend
script:
- echo "Build starting - PRODUCTION branch"
- npm i
- npm run build
- echo "Build completed - PRODUCTION branch"
only:
- main
except:
changes:
- frontend/**/*
# Deploy the frontend build to production to Netlify
deploy_production_frontend:
stage: deploy_stage
before_script:
- apt update
- apt install curl -y
script:
- echo "Deployment starting - PRODUCTION branch"
- curl -X POST "https://api.netlify.com/build_hooks/${NETLIFY_PRODUCTION_DEPLOY_KEY}"
- echo "Deployment completed - PRODUCTION branch"
only:
- main