This commit is contained in:
+20
-8
@@ -1,11 +1,24 @@
|
|||||||
|
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: deploy
|
name: ci-cd-full
|
||||||
depends_on:
|
|
||||||
- build-push
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
# ШАГ 1: Сборка и пуш образа в Gitea Registry
|
||||||
|
- name: docker-build
|
||||||
|
image: plugins/docker
|
||||||
|
pull: always
|
||||||
|
settings:
|
||||||
|
registry: gitea.allowlgroup.ru
|
||||||
|
repo: gitea.allowlgroup.ru/na-granicelife.ru/front
|
||||||
|
tags:
|
||||||
|
- latest
|
||||||
|
- "${DRONE_TARGET_BRANCH:-main}"
|
||||||
|
username:
|
||||||
|
from_secret: registry_username
|
||||||
|
password:
|
||||||
|
from_secret: registry_password
|
||||||
|
|
||||||
|
# ШАГ 2: Деплой на сервер (выполнится ТОЛЬКО если Шаг 1 успешен)
|
||||||
- name: ssh-deploy
|
- name: ssh-deploy
|
||||||
image: appleboy/drone-ssh:1.7
|
image: appleboy/drone-ssh:1.7
|
||||||
pull: always
|
pull: always
|
||||||
@@ -23,13 +36,12 @@ steps:
|
|||||||
# 1. Создаем структуру папок в домашней директории (там точно есть права)
|
# 1. Создаем структуру папок в домашней директории (там точно есть права)
|
||||||
- mkdir -p ~/na-granicelife/assets/mp4
|
- mkdir -p ~/na-granicelife/assets/mp4
|
||||||
|
|
||||||
# 2. Клонируем код во временную папку (быстро, только последний коммит)
|
# 2. Клонируем код во временную папку
|
||||||
- rm -rf /tmp/na-granice-deploy
|
- rm -rf /tmp/na-granice-deploy
|
||||||
- git clone --depth 1 --branch main https://gitea.allowlgroup.ru/na-granicelife.ru/front.git /tmp/na-granice-deploy
|
- git clone --depth 1 --branch main https://gitea.allowlgroup.ru/na-granicelife.ru/front.git /tmp/na-granice-deploy
|
||||||
|
|
||||||
# 3. Копируем файлы, КРОМЕ папки с видео.
|
# 3. Копируем файлы, КРОМЕ папки с видео (используем find+cp, чтобы не ставить rsync)
|
||||||
# find нужен, чтобы копировать рекурсивно, игнорируя mp4.
|
# Это безопасно: видео не перезапишется и не удалится
|
||||||
# -not -path '*assets/mp4*' исключает всю папку mp4 из копирования.
|
|
||||||
- find /tmp/na-granice-deploy -type f -not -path '*assets/mp4*' -exec cp --no-preserve=mode {} ~/na-granicelife \;
|
- find /tmp/na-granice-deploy -type f -not -path '*assets/mp4*' -exec cp --no-preserve=mode {} ~/na-granicelife \;
|
||||||
|
|
||||||
# 4. Чистим временную папку
|
# 4. Чистим временную папку
|
||||||
|
|||||||
Reference in New Issue
Block a user