Files
xkater/.woodpecker.yaml
2026-04-12 18:57:54 +07:00

65 lines
1.7 KiB
YAML

# .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 is = $MY_HOST"
- echo "USER is = $MY_USER"
- env | grep -i prod || echo "no prod vars found"
when:
branch: main
# Шаг 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: drillster/drone-rsync
secrets:
- source: prod_ssh_user
target: RSYNC_USER
- source: prod_ssh_host
target: RSYNC_HOSTS
- source: prod_ssh_key
target: RSYNC_KEY
- source: remote_path
target: REMOTE_PATH
settings:
port: 22
source: ./wp-content/
recursive: true
delete: false
args: '--exclude=uploads/ --exclude=plugins/akismet/ --exclude=.git/ --exclude=node_modules/ --exclude=.DS_Store'
when:
branch: main
# Шаг 3: Очистка кэша
- name: flush-cache
image: appleboy/drone-ssh
secrets:
- source: prod_ssh_host
target: SSH_HOST
- source: prod_ssh_user
target: SSH_USERNAME
- source: prod_ssh_key
target: SSH_KEY
- source: remote_path
target: REMOTE_PATH
settings:
script:
- cd $REMOTE_PATH
- if command -v wp > /dev/null 2>&1; then wp cache flush; fi
- touch wp-config.php
when:
branch: main