demo/.woodpecker-aliyun/deploy-aliyun.yaml

45 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.

# 遵循文档:顶层直接写 steps 和 matrix不写 kind 和 name
matrix:
include:
- NODE_NAME: "集群节点A (136服务器)"
SECRET_NODE_IP: "136_ssh_host"
SECRET_USER_NAME: "136_ssh_user"
SECRET_PASS_NAME: "136_ssh_password"
- NODE_NAME: "集群节点B (114服务器)"
SECRET_NODE_IP: "114_ssh_host"
SECRET_USER_NAME: "114_ssh_user"
SECRET_PASS_NAME: "114_ssh_password"
steps:
- name: 远程终端集群部署
image: appleboy/drone-ssh:latest
settings:
host:
from_secret: ${SECRET_NODE_IP}
username:
from_secret: ${SECRET_USER_NAME}
password:
from_secret: ${SECRET_PASS_NAME}
port: 22
secrets: [ aliyun_acr_username, aliyun_acr_password ]
envs: [ NODE_NAME, SECRET_NODE_IP, aliyun_acr_username, aliyun_acr_password ]
script:
- echo "========================================="
- echo "🚀 开始部署节点:$NODE_NAME"
- echo "========================================="
- docker login --username "$aliyun_acr_username" --password "$aliyun_acr_password" registry.cn-zhangjiakou.aliyuncs.com
- docker stop demo-container || true
- docker rm demo-container || true
- docker pull registry.cn-zhangjiakou.aliyuncs.com/abhors/demo:latest
- docker run -d --name demo-container -p 8080:8080 --restart always registry.cn-zhangjiakou.aliyuncs.com/abhors/demo:latest
- echo "🎉 $NODE_NAME 部署成功!"
when:
event: [push, pull_request, manual]
branch: master
# 🔗 遵循文档最核心逻辑:
# 因为上游文件叫 build.yaml这里必须写去掉后缀的文件名build
depends_on:
- build