64 lines
1.4 KiB
YAML
64 lines
1.4 KiB
YAML
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: deploy
|
|
|
|
node:
|
|
runner: ip165
|
|
|
|
trigger:
|
|
branch:
|
|
- main
|
|
- master
|
|
event:
|
|
- push
|
|
|
|
steps:
|
|
- name: package
|
|
image: docker.1ms.run/library/alpine:latest
|
|
commands:
|
|
- apk add --no-cache tar
|
|
- mkdir -p dist
|
|
- tar czf dist/feishu-approval.tar.gz --exclude=.git --exclude=dist -C . .
|
|
|
|
- name: upload
|
|
image: appleboy/drone-scp
|
|
pull: if-not-exists
|
|
settings:
|
|
host:
|
|
from_secret: deploy_host
|
|
username:
|
|
from_secret: deploy_user
|
|
password:
|
|
from_secret: deploy_password
|
|
port: 22
|
|
target: /tmp
|
|
source:
|
|
- dist/feishu-approval.tar.gz
|
|
strip_components: 1
|
|
overwrite: true
|
|
|
|
- name: deploy
|
|
image: appleboy/drone-ssh
|
|
pull: if-not-exists
|
|
settings:
|
|
host:
|
|
from_secret: deploy_host
|
|
username:
|
|
from_secret: deploy_user
|
|
password:
|
|
from_secret: deploy_password
|
|
port: 22
|
|
script:
|
|
- set -e
|
|
- 'DEPLOY_PATH="/www/wwwroot/node_project"'
|
|
- 'ARCHIVE="/tmp/feishu-approval.tar.gz"'
|
|
- pm2 stop feishu_approval
|
|
- test -f "$ARCHIVE"
|
|
- mkdir -p "$DEPLOY_PATH"
|
|
- find "$DEPLOY_PATH" -mindepth 1 -delete
|
|
- tar xzf "$ARCHIVE" -C "$DEPLOY_PATH"
|
|
- chmod +x "$DEPLOY_PATH/deploy/start.sh"
|
|
- echo "Deploy OK -> $DEPLOY_PATH"
|
|
- pm2 start feishu_approval
|