Files
learn-languages/.drone.yml
goddonebianu 75ed2c6d12
Some checks reported errors
continuous-integration/drone/push Build encountered an error
continuous-integration/drone Build is failing
...
2025-10-14 21:15:25 +08:00

81 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
environment:
ZHIPU_API_KEY:
from_secret: zhipu_api_key
commands:
- apk add zip
- cd .next/standalone
- echo "ZHIPU_API_KEY="$ZHIPU_API_KEY > .env
- zip -r /dist/learn-languages.zip *
volumes:
- name: debian-dist
path: /dist
- name: transfer file
image: appleboy/drone-scp
settings:
host:
from_secret: SSH_HOST
username:
from_secret: SSH_USERNAME
key:
from_secret: SSH_KEY
port: 22
target: /home/debian
source:
- /dist/learn-languages.zip
rm_target: true
strip_components: 1
debug: true
volumes:
- name: debian-dist
path: /dist
- name: deploy
image: appleboy/drone-ssh
settings:
host:
from_secret: ssh_host
username:
from_secret: ssh_username
key:
from_secret: ssh_key
port: 22
script:
- cd ~/
- unzip -d learn-languages -o learn-languages.zip
- rm learn-languages.zip
- cd learn-languages
- |
if pm2 list | grep -q learn-languages; then
echo "进程 learn-languages 已在pm2中运行正在重启..."
pm2 restart "learn-languages"
else
echo "进程 learn-languages 未在pm2中运行正在启动..."
pm2 start "./server.js" --name "learn-languages"
fi
- pm2 save
debug: true
volumes:
- name: debian-dist
host:
path: /home/debian/dist