ManiCandles/.drone.yml

81 lines
2.1 KiB
YAML

kind: pipeline
type: docker
name: Validate and deploy frontend
steps:
- name: Check deployment access
image: appleboy/drone-ssh
settings:
host: server1.midastix.com
username: mihir
key:
from_secret: manicandles_deploy_key
port: 22
script_stop: true
script:
- test -w /var/www/manicandles/releases && test -w /var/www/manicandles/incoming
- test -r /etc/nginx/snippets/manicandles.conf
- command -v flock && command -v curl
when:
branch:
- main
event:
- push
- name: Validate Nginx configuration
image: nginx:alpine
commands:
- printf 'events {}\nhttp { server { listen 8080; include /drone/src/deploy/nginx-locations.conf; } }\n' > /tmp/manicandles-nginx.conf
- nginx -t -c /tmp/manicandles-nginx.conf
- name: Quality gates
image: node:24-alpine
environment:
# Keep jsdom suites from competing for CPU on the Drone runner.
VITEST_MAX_WORKERS: "1"
commands:
- npm ci
- npm audit --audit-level=high
- npm run check
- apk add --no-cache util-linux
- sh test/deployment.test.sh
- printf '%s\n' '${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA}' > dist/release.txt
- name: Upload frontend release
image: appleboy/drone-scp
settings:
host: server1.midastix.com
username: mihir
key:
from_secret: manicandles_deploy_key
port: 22
source: dist,scripts/deploy-frontend.sh
target: /var/www/manicandles/incoming/${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA}
when:
branch:
- main
event:
- push
- name: Activate and verify frontend
image: appleboy/drone-ssh
settings:
host: server1.midastix.com
username: mihir
key:
from_secret: manicandles_deploy_key
port: 22
command_timeout: 5m
script_stop: true
script:
- sh /var/www/manicandles/incoming/${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA}/scripts/deploy-frontend.sh /var/www/manicandles '${DRONE_BUILD_NUMBER}-${DRONE_COMMIT_SHA}' manicandles.midastix.com
when:
branch:
- main
event:
- push