liste-de-courses-www/.drone.yml

128 lines
2.4 KiB
YAML
Raw Normal View History

kind: pipeline
type: docker
2022-08-06 13:05:16 +00:00
name: analyseAndBuild
steps:
2022-07-22 18:45:41 +00:00
- name: code-analysis
image: sonarsource/sonar-scanner-cli
2022-07-22 19:46:00 +00:00
detach: true
failure: ignore
2022-07-22 18:45:41 +00:00
commands:
- ls -la
- sonar-scanner -Dsonar.projectKey=LDC-WWW -Dsonar.sources=. -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN
2022-07-22 19:46:00 +00:00
environment:
SONAR_HOST_URL:
from_secret: sonarScannerHostUrl
SONAR_LOGIN:
from_secret: sonarScannerLogin
2022-07-22 18:45:41 +00:00
2022-08-06 13:35:54 +00:00
- name: restore-cache
image: drillster/drone-volume-cache
volumes:
- name: cache
path: /cache
settings:
restore: true
mount:
- ./node_modules
2022-08-06 13:46:18 +00:00
cache_key: [ DRONE_REPO_OWNER, DRONE_REPO_NAME, DRONE_BRANCH ]
2022-07-20 06:54:22 +00:00
- name: build
image: node:14
commands:
- npm install
- npm run lint
- npm run build:prod
environment:
VUE_APP_API_BASE_URL:
from_secret: baseurl
2022-08-06 13:35:54 +00:00
- name: rebuild-cache
image: drillster/drone-volume-cache
volumes:
- name: cache
path: /cache
settings:
rebuild: true
mount:
- ./node_modules
2022-08-06 13:46:18 +00:00
cache_key: [ DRONE_REPO_OWNER, DRONE_REPO_NAME, DRONE_BRANCH ]
2022-08-06 13:35:54 +00:00
2022-08-06 13:05:16 +00:00
trigger:
event:
- push
- pull_request
2022-08-06 13:35:54 +00:00
volumes:
- name: cache
host:
path: /tmp/cache
2022-08-06 13:05:16 +00:00
---
kind: pipeline
type: docker
name: CopyToServer
steps:
2022-08-06 13:35:54 +00:00
- name: restore-cache
image: drillster/drone-volume-cache
volumes:
- name: cache
path: /cache
settings:
restore: true
mount:
- ./node_modules
2022-08-06 13:46:18 +00:00
cache_key: [ DRONE_REPO_OWNER, DRONE_REPO_NAME, DRONE_BRANCH ]
2022-08-06 13:35:54 +00:00
2022-08-06 13:13:04 +00:00
- 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/*
2022-08-06 13:05:16 +00:00
trigger:
event:
- promote
target:
- production
---
kind: pipeline
type: ssh
name: Deploy
server:
host: amine-louveau.fr
user: ubuntu
ssh_key:
from_secret: ssh_key
steps:
- name: copy
commands:
- 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/
2022-08-06 13:24:06 +00:00
depends_on:
- CopyToServer
2022-08-06 13:24:47 +00:00
trigger:
event:
- promote
target:
- production