From 5e610a398028cad4134e4edd09068e8cc21f21fd Mon Sep 17 00:00:00 2001 From: Konstantin Date: Sun, 12 Apr 2026 20:49:19 +0700 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20.woodpecker.yaml=2012?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .woodpecker.yaml | 61 +++++++++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/.woodpecker.yaml b/.woodpecker.yaml index 7b6b56e..787a25f 100644 --- a/.woodpecker.yaml +++ b/.woodpecker.yaml @@ -11,27 +11,39 @@ steps: # Шаг 2: Деплой на боевой сервер - name: deploy-production - image: drillster/drone-rsync - settings: - user: - from_secret: PROD_SSH_USER - hosts: - from_secret: PROD_SSH_HOST - port: 22 - key: + image: alpine:latest + environment: + SSH_KEY: from_secret: PROD_SSH_KEY - source: ./wp-content/ - target: /var/www/your-site/wp-content/ - recursive: true - delete: false - args: > - --exclude=uploads/ - --exclude=plugins/akismet/ - --exclude=plugins/index.php - --exclude=.git/ - --exclude=node_modules/ - --exclude=.DS_Store - --exclude=mu-plugins/local-dev-performance.php + SSH_USER: + from_secret: PROD_SSH_USER + SSH_HOST: + from_secret: PROD_SSH_HOST + REMOTE_PATH: + from_secret: REMOTE_PATH + commands: + # Устанавливаем rsync и openssh + - apk add --no-cache rsync openssh-client + + # Настраиваем SSH-ключ + - mkdir -p ~/.ssh + - echo "$SSH_KEY" > ~/.ssh/id_rsa + - chmod 600 ~/.ssh/id_rsa + - ssh-keyscan -H "$SSH_HOST" >> ~/.ssh/known_hosts 2>/dev/null + + # Запускаем rsync + - | + rsync -az \ + --exclude=uploads/ \ + --exclude=plugins/akismet/ \ + --exclude=plugins/index.php \ + --exclude=.git/ \ + --exclude=node_modules/ \ + --exclude=.DS_Store \ + --exclude=mu-plugins/local-dev-performance.php \ + -e "ssh -p 22 -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no" \ + ./wp-content/ \ + "$SSH_USER@$SSH_HOST:$REMOTE_PATH/wp-content/" when: branch: main @@ -45,9 +57,14 @@ steps: from_secret: PROD_SSH_USER key: from_secret: PROD_SSH_KEY + envs: + - REMOTE_PATH script: - - cd /var/www/your-site - - if command -v wp &> /dev/null; then wp cache flush; fi + - cd $REMOTE_PATH + - if command -v wp > /dev/null 2>&1; then wp cache flush; fi - touch wp-config.php + environment: + REMOTE_PATH: + from_secret: REMOTE_PATH when: branch: main