2024-10-14 19:03:10 +08:00
|
|
|
steps:
|
2024-10-17 14:49:30 +08:00
|
|
|
- name: deploy
|
|
|
|
image: alpine:3.20.3
|
2024-10-14 19:03:10 +08:00
|
|
|
when:
|
|
|
|
- branch: master
|
|
|
|
event: push
|
|
|
|
commands:
|
|
|
|
- apk add --no-cache openssh-client
|
|
|
|
- mkdir -p /root/.ssh/
|
|
|
|
- echo "$SSH_KEY" | tr -d '\r' > /root/.ssh/id_rsa
|
2024-10-16 15:27:00 +08:00
|
|
|
- chmod 600 /root/.ssh/id_rsa
|
2024-10-14 19:03:10 +08:00
|
|
|
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > /root/.ssh/config
|
2024-10-17 14:49:30 +08:00
|
|
|
- ssh -r "$REMOTE_HOST" 'cd "$PROJECT_DIRECTORY";
|
|
|
|
docker-compose down;
|
|
|
|
docker-compose up;'
|
2024-10-14 19:11:30 +08:00
|
|
|
secrets: [SSH_KEY, REMOTE_HOST, PROJECT_DIRECTORY]
|
2024-10-17 14:49:30 +08:00
|
|
|
|
|
|
|
depends_on:
|
|
|
|
- build
|