Files
feishu_approval_design/.drone.yml
Weiming b0bfd88b7b
All checks were successful
continuous-integration/drone/push Build is passing
测试
2026-06-27 13:38:24 +08:00

66 lines
1.6 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:3.20
commands:
- 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"'
- 'APP_NAME="feishu_approval"'
- 'LEGACY_APP_NAME="feishu-approval"'
- 'pm2 delete "$APP_NAME" >/dev/null 2>&1 || true'
- 'pm2 delete "$LEGACY_APP_NAME" >/dev/null 2>&1 || true'
- 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 "$DEPLOY_PATH/deploy/start.sh" --name "$APP_NAME"'