Изменение .woodpecker.yaml 10
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
Konstantin
2026-04-12 20:23:30 +07:00
parent c73e74586f
commit 75c9e9cb13

View File

@@ -1,75 +1,49 @@
when:
branch: main
event: push
# .woodpecker.yaml
steps:
- name: debug-secrets
image: alpine
environment:
MY_HOST:
from_secret: PROD_SSH_HOST
MY_USER:
from_secret: PROD_SSH_USER
commands:
- echo "HOST = $MY_HOST"
- echo "USER = $MY_USER"
# Шаг 1: Сборка ассетов темы
- name: build-assets
image: node:20-alpine
commands:
- cd wp-content/themes/xkater
- if [ -f package.json ]; then npm ci && npm run build; fi
when:
branch: main
# Шаг 2: Деплой на боевой сервер
- name: deploy-production
image: alpine
environment:
SSH_KEY:
from_secret: PROD_SSH_KEY
SSH_HOST:
from_secret: PROD_SSH_HOST
SSH_USER:
from_secret: PROD_SSH_USER
REMOTE_PATH:
from_secret: REMOTE_PATH
commands:
- apk add --no-cache rsync openssh-client
- mkdir -p ~/.ssh
- echo "$SSH_KEY" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -H $SSH_HOST >> ~/.ssh/known_hosts
- |
rsync -avz \
--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 -i ~/.ssh/id_rsa -p 22 -o StrictHostKeyChecking=no" \
./wp-content/ \
$SSH_USER@$SSH_HOST:$REMOTE_PATH/wp-content/
image: drillster/drone-rsync
settings:
user: ${PROD_SSH_USER}
hosts:
- ${PROD_SSH_HOST}
port: 22
key: ${PROD_SSH_KEY}
source: ./wp-content/
target: ${REMOTE_PATH}/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
when:
branch: main
# Шаг 3: Очистка кэша на сервере
- name: flush-cache
image: alpine
environment:
SSH_KEY:
from_secret: PROD_SSH_KEY
SSH_HOST:
from_secret: PROD_SSH_HOST
SSH_USER:
from_secret: PROD_SSH_USER
REMOTE_PATH:
from_secret: REMOTE_PATH
commands:
- apk add --no-cache openssh-client
- mkdir -p ~/.ssh
- echo "$SSH_KEY" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -H $SSH_HOST >> ~/.ssh/known_hosts
- |
ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no $SSH_USER@$SSH_HOST "
cd $REMOTE_PATH
if command -v wp > /dev/null 2>&1; then wp cache flush; fi
touch wp-config.php
"
image: appleboy/drone-ssh
settings:
host: ${PROD_SSH_HOST}
username: ${PROD_SSH_USER}
key: ${PROD_SSH_KEY}
script:
- cd ${REMOTE_PATH}
- if command -v wp &> /dev/null; then wp cache flush; fi
- touch wp-config.php
when:
branch: main
# Убрали status - он не нужен для этого шага