demo/.woodpecker.yaml

62 lines
1.9 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.

# 第 97 次部署
steps:
- name: Java 构建
image: library/maven:3.9.6-eclipse-temurin-17
pull: true
commands:
- mvn clean package -DskipTests
volumes:
- /tmp/maven-cache:/root/.m2
when:
event: [push, pull_request]
branch: master
- name: 构建与推送
image: docker.m.daocloud.io/woodpeckerci/plugin-docker-buildx:latest-insecure
privileged: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
settings:
repo: push.lovestory.cyou/abhors/demo
registry: push.lovestory.cyou
username:
from_secret: nexus_docker_username
password:
from_secret: nexus_docker_password
mirror: https://registry.lovestory.cyou
when:
event: push
branch: master
- name: 远程终端部署
image: registry.lovestory.cyou/appleboy/drone-ssh:latest
environment:
NEXUS_DOCKER_USERNAME:
from_secret: nexus_docker_username
NEXUS_DOCKER_PASSWORD:
from_secret: nexus_docker_password
settings:
host: 43.143.243.136
port: 22
username:
from_secret: 136_ssh_user
password:
from_secret: 136_ssh_password
secrets: [ nexus_docker_username, nexus_docker_password ]
envs:
- NEXUS_DOCKER_USERNAME
- NEXUS_DOCKER_PASSWORD
script:
- echo "========================================="
- echo "🚀 开始部署节点43.143.243.136"
- echo "========================================="
- docker login --username "${NEXUS_DOCKER_USERNAME}" --password "${NEXUS_DOCKER_PASSWORD}" push.lovestory.cyou
- docker stop demo-container || true
- docker rm demo-container || true
- docker pull push.lovestory.cyou/abhors/demo:latest
- docker run -d --name demo-container -p 8080:8080 --restart always push.lovestory.cyou/abhors/demo:latest
when:
event: push
branch: master