-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
34 lines (31 loc) · 1.06 KB
/
.gitlab-ci.yml
File metadata and controls
34 lines (31 loc) · 1.06 KB
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
stages:
- lint 💄
- test 🧪
- deploy 🚀
lint:
stage: lint 💄
image: node:20.0.0-alpine
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_BRANCH != 'main'
script:
- npx prettier -c ./frontend/**/*.js ./frontend/**/*.html
- npx prettier -c ./backend/**/*.js
test:
stage: test 🧪
image: node:20.0.0-alpine
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_BRANCH != 'main'
script:
- npm install --prefix ./backend
- npm run test --prefix ./backend
deploy_to_s3:
stage: deploy 🚀
image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest
rules:
- if: $CI_COMMIT_BRANCH == 'main' && $CI_PIPELINE_SOURCE == 'push'
script:
- sed -i -E 's/const API_URL = "(.*)"/const API_URL = "http:\/\/csimonmeunier.me:3000"/g' frontend/scripts/toolbar.js
- sed -i -E 's/const WS_URL = "(.*)"/const WS_URL = "ws:\/\/csimonmeunier.me:3000\/collaboration"/g' frontend/scripts/collaboration.js
- aws s3 sync frontend/ s3://nlpf-frontend-website --delete