Refactor pipeline script

This commit is contained in:
Murtadha 2024-07-27 21:14:34 -04:00
parent 2af2d81115
commit 5fabaa88e8

View file

@ -1,17 +1,14 @@
--- ---
# kind: pipeline
# type: docker
# name: default
steps: steps:
- name: build build:
image: node:22 image: node:22
commands: commands:
- npm ci - npm ci
- npm run build - npm run build
- echo "VERSION=$(cat version.txt)" > .env - echo "VERSION=$(cat version.txt)" > .env
- name: clear-from-host clear-from-host:
image: appleboy/drone-ssh image: appleboy/drone-ssh
settings: settings:
host: host:
@ -27,7 +24,7 @@ steps:
- find . -maxdepth 1 -type f -delete - find . -maxdepth 1 -type f -delete
- echo "Target directory cleared, resumes folder preserved" - echo "Target directory cleared, resumes folder preserved"
- name: copy-to-host copy-to-host:
image: appleboy/drone-scp image: appleboy/drone-scp
settings: settings:
host: host:
@ -43,7 +40,7 @@ steps:
- nginx.conf - nginx.conf
- version.txt - version.txt
- name: deploy deploy:
image: appleboy/drone-ssh image: appleboy/drone-ssh
settings: settings:
host: host:
@ -73,7 +70,7 @@ steps:
- docker tag nginx:alpine frontend:$VERSION - docker tag nginx:alpine frontend:$VERSION
- echo "Deployment completed" - echo "Deployment completed"
- name: confirm-deployment confirm-deployment:
image: appleboy/drone-ssh image: appleboy/drone-ssh
settings: settings:
host: host:
@ -103,7 +100,7 @@ steps:
- curl -I http://localhost:5173 || { echo "HTTP request failed"; exit 1; } - curl -I http://localhost:5173 || { echo "HTTP request failed"; exit 1; }
- echo "Deployment confirmed successfully" - echo "Deployment confirmed successfully"
- name: cleanup cleanup:
image: appleboy/drone-ssh image: appleboy/drone-ssh
settings: settings:
host: host: