Files
learn-languages/.drone.yml
goddonebianu 0458d08c09
Some checks failed
continuous-integration/drone/push Build is failing
...
2025-10-15 21:38:00 +08:00

73 lines
1.7 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
kind: pipeline
type: docker
name: learn-languages
platform:
os: linux
arch: amd64
steps:
- name: build
image: node:23-alpine
commands:
- npm ci
- npm run build
- name: package
image: node:23-alpine
commands:
- rm -rf /dist/* /dist/.*
- apk add zip
- mkdir -p .next/standalone/.next
- cp -r public .next/standalone
- cp -r .next/static .next/standalone/.next
- cd .next/standalone
- zip -r ./learn-languages.zip ./*
- name: transfer file
image: appleboy/drone-scp
settings:
host:
from_secret: ssh_host
username:
from_secret: ssh_username
password:
from_secret: ssh_password
port: 22
target: /home/debian
source:
- ./learn-languages.zip
rm_target: true
debug: true
- name: deploy
image: appleboy/drone-ssh
environment:
ZHIPU_API_KEY:
from_secret: zhipu_api_key
settings:
host:
from_secret: ssh_host
username:
from_secret: ssh_username
password:
from_secret: ssh_password
port: 22
script:
- cd ~/
- rm -rf learn-languages/* learn-languages/.*
- unzip -d learn-languages learn-languages.zip
- cd learn-languages
- npm i
- |
if pm2 list | grep -q learn-languages; then
echo "进程 learn-languages 已在pm2中运行正在重启..."
ZHIPU_API_KEY=${ZHIPU_API_KEY} PORT=3030 pm2 restart "learn-languages"
else
echo "进程 learn-languages 未在pm2中运行正在启动..."
ZHIPU_API_KEY=${ZHIPU_API_KEY} PORT=3030 pm2 start "./server.js" --name "learn-languages"
fi
- pm2 save
debug: true