117 lines
2.3 KiB
YAML
117 lines
2.3 KiB
YAML
kind: pipeline
|
|
type: docker
|
|
name: analyseAndBuild
|
|
|
|
steps:
|
|
- name: code-analysis
|
|
image: sonarsource/sonar-scanner-cli
|
|
detach: true
|
|
failure: ignore
|
|
commands:
|
|
- ls -la
|
|
- sonar-scanner -Dsonar.projectKey=LDC-WWW -Dsonar.sources=. -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN
|
|
environment:
|
|
SONAR_HOST_URL:
|
|
from_secret: sonarScannerHostUrl
|
|
SONAR_LOGIN:
|
|
from_secret: sonarScannerLogin
|
|
|
|
- name: restore-cache
|
|
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:
|
|
- npm install
|
|
- ls -la ./node_modules
|
|
- npm run lint
|
|
- npm run build:prod
|
|
environment:
|
|
VUE_APP_API_BASE_URL:
|
|
from_secret: baseurl
|
|
|
|
- name: rebuild-cache
|
|
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: restore-cache
|
|
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:
|
|
- npm install
|
|
- npm run build:prod
|
|
environment:
|
|
VUE_APP_API_BASE_URL:
|
|
from_secret: baseurl
|
|
|
|
- name: scp files
|
|
image: appleboy/drone-scp
|
|
settings:
|
|
host: amine-louveau.fr
|
|
username: ubuntu
|
|
key:
|
|
from_secret: privateKey
|
|
port: 22
|
|
target: /home/ubuntu/courses
|
|
source: dist/*
|
|
|
|
- name: deploy
|
|
image: appleboy/drone-ssh
|
|
settings:
|
|
host: amine-louveau.fr
|
|
user: ubuntu
|
|
key:
|
|
from_secret: ssh_key
|
|
command_timeout: 2m
|
|
script:
|
|
- cd /home/ubuntu/courses
|
|
- mv dist/* ./
|
|
- sudo chown www-data:www-data ./*
|
|
- sudo rm -rf /var/www/amine/courses/*
|
|
- sudo mv ./* /var/www/amine/courses/
|
|
trigger:
|
|
event:
|
|
- promote
|
|
target:
|
|
- production
|