diff --git a/.drone.yml b/.drone.yml index ffd17f3..fd094f8 100644 --- a/.drone.yml +++ b/.drone.yml @@ -25,12 +25,13 @@ steps: restore: true mount: - ./node_modules - cache_key: [ DRONE_REPO_OWNER, DRONE_REPO_NAME, DRONE_BRANCH ] + 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: @@ -46,7 +47,7 @@ steps: rebuild: true mount: - ./node_modules - cache_key: [ DRONE_REPO_OWNER, DRONE_REPO_NAME, DRONE_BRANCH ] + cache_key: [ DRONE_REPO_NAME, DRONE_BRANCH ] trigger: event: @@ -60,7 +61,7 @@ volumes: --- kind: pipeline type: docker -name: CopyToServer +name: Deploy steps: - name: restore-cache @@ -72,7 +73,7 @@ steps: restore: true mount: - ./node_modules - cache_key: [ DRONE_REPO_OWNER, DRONE_REPO_NAME, DRONE_BRANCH ] + cache_key: [ DRONE_REPO_NAME, DRONE_BRANCH ] - name: build image: node:14 @@ -93,33 +94,21 @@ steps: port: 22 target: /home/ubuntu/courses source: dist/* -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/ -depends_on: - - CopyToServer + + - 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