2022-09-29 13:09:17 +00:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: analyseAndBuild
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: code-analysis
|
|
|
|
image: sonarsource/sonar-scanner-cli
|
|
|
|
detach: true
|
|
|
|
failure: ignore
|
|
|
|
commands:
|
|
|
|
- sonar-scanner -Dsonar.projectKey=cv -Dsonar.sources=. -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN
|
|
|
|
environment:
|
|
|
|
SONAR_HOST_URL:
|
|
|
|
from_secret: sonarScannerHostUrl
|
|
|
|
SONAR_LOGIN:
|
|
|
|
from_secret: sonarScannerLogin
|
|
|
|
|
2022-09-29 13:21:05 +00:00
|
|
|
- name: buildAndTest
|
2022-09-29 13:09:17 +00:00
|
|
|
image: node:14
|
|
|
|
commands:
|
|
|
|
- npm install
|
2022-09-29 13:12:08 +00:00
|
|
|
- npm run build
|
2022-10-01 15:51:49 +00:00
|
|
|
environment:
|
|
|
|
REACT_APP_API_BASE_URL:
|
|
|
|
from_secret: baseurl
|
2022-09-29 13:09:17 +00:00
|
|
|
|
|
|
|
- name: saveNodeModules
|
|
|
|
image: drillster/drone-volume-cache
|
|
|
|
volumes:
|
|
|
|
- name: cache
|
|
|
|
path: /cache
|
|
|
|
settings:
|
|
|
|
rebuild: true
|
|
|
|
mount:
|
|
|
|
- ./node_modules
|
|
|
|
cache_key: [ DRONE_REPO_NAME, DRONE_BRANCH ]
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
- push
|
|
|
|
- pull_request
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
- name: cache
|
|
|
|
host:
|
|
|
|
path: /tmp/cache
|
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: Deploy
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: getNodeModules
|
|
|
|
image: drillster/drone-volume-cache
|
|
|
|
volumes:
|
|
|
|
- name: cache
|
|
|
|
path: /cache
|
|
|
|
settings:
|
|
|
|
restore: true
|
|
|
|
mount:
|
|
|
|
- ./node_modules
|
|
|
|
cache_key: [ DRONE_REPO_NAME, DRONE_BRANCH ]
|
|
|
|
|
|
|
|
- name: build
|
|
|
|
image: node:14
|
|
|
|
commands:
|
2022-09-29 13:12:08 +00:00
|
|
|
- npm run build
|
2022-09-29 13:09:17 +00:00
|
|
|
|
|
|
|
- name: scpFiles
|
|
|
|
image: appleboy/drone-scp
|
|
|
|
settings:
|
|
|
|
host: amine-louveau.fr
|
|
|
|
username: ubuntu
|
|
|
|
key:
|
|
|
|
from_secret: privateKey
|
|
|
|
port: 22
|
2022-09-29 13:12:08 +00:00
|
|
|
target: /home/ubuntu/cv
|
2022-10-01 20:38:46 +00:00
|
|
|
source: build/*
|
2022-09-29 13:09:17 +00:00
|
|
|
|
|
|
|
- name: deploy
|
|
|
|
image: appleboy/drone-ssh
|
|
|
|
settings:
|
|
|
|
host: amine-louveau.fr
|
|
|
|
user: ubuntu
|
|
|
|
key:
|
|
|
|
from_secret: privateKey
|
|
|
|
command_timeout: 2m
|
|
|
|
script:
|
2022-09-29 13:12:08 +00:00
|
|
|
- cd /home/ubuntu/cv
|
2022-10-01 20:38:46 +00:00
|
|
|
- mv build/* ./
|
2022-09-29 13:09:17 +00:00
|
|
|
- sudo chown www-data:www-data ./*
|
2022-09-29 13:12:08 +00:00
|
|
|
- sudo rm -rf /var/www/amine/CV2/*
|
|
|
|
- sudo mv ./* /var/www/amine/CV2/
|
2022-09-29 13:09:17 +00:00
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
- promote
|
|
|
|
target:
|
|
|
|
- production
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
- name: cache
|
|
|
|
host:
|
|
|
|
path: /tmp/cache
|