Изменение .woodpecker.yaml 8
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
# .woodpecker.yaml
|
when:
|
||||||
|
branch: main
|
||||||
|
event: push
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: debug-secrets
|
- name: debug-secrets
|
||||||
image: alpine
|
image: alpine
|
||||||
@@ -8,57 +11,58 @@ steps:
|
|||||||
MY_USER:
|
MY_USER:
|
||||||
from_secret: prod_ssh_user
|
from_secret: prod_ssh_user
|
||||||
commands:
|
commands:
|
||||||
- echo "HOST is = $MY_HOST"
|
- echo "HOST = $MY_HOST"
|
||||||
- echo "USER is = $MY_USER"
|
- echo "USER = $MY_USER"
|
||||||
- env | grep -i prod || echo "no prod vars found"
|
|
||||||
when:
|
|
||||||
branch: main
|
|
||||||
# Шаг 1: Сборка ассетов темы
|
|
||||||
- name: build-assets
|
- name: build-assets
|
||||||
image: node:20-alpine
|
image: node:20-alpine
|
||||||
commands:
|
commands:
|
||||||
- cd wp-content/themes/xkater
|
- cd wp-content/themes/xkater
|
||||||
- if [ -f package.json ]; then npm ci && npm run build; fi
|
- if [ -f package.json ]; then npm ci && npm run build; fi
|
||||||
when:
|
|
||||||
branch: main
|
|
||||||
|
|
||||||
# Шаг 2: Деплой на боевой сервер
|
|
||||||
- name: deploy-production
|
- name: deploy-production
|
||||||
image: drillster/drone-rsync
|
image: alpine
|
||||||
secrets:
|
environment:
|
||||||
- source: prod_ssh_user
|
SSH_KEY:
|
||||||
target: RSYNC_USER
|
from_secret: prod_ssh_key
|
||||||
- source: prod_ssh_host
|
SSH_HOST:
|
||||||
target: RSYNC_HOSTS
|
from_secret: prod_ssh_host
|
||||||
- source: prod_ssh_key
|
SSH_USER:
|
||||||
target: RSYNC_KEY
|
from_secret: prod_ssh_user
|
||||||
- source: remote_path
|
REMOTE_PATH:
|
||||||
target: REMOTE_PATH
|
from_secret: remote_path
|
||||||
settings:
|
commands:
|
||||||
port: 22
|
- apk add --no-cache rsync openssh-client
|
||||||
source: ./wp-content/
|
- mkdir -p ~/.ssh
|
||||||
recursive: true
|
- echo "$SSH_KEY" > ~/.ssh/id_rsa
|
||||||
delete: false
|
- chmod 600 ~/.ssh/id_rsa
|
||||||
args: '--exclude=uploads/ --exclude=plugins/akismet/ --exclude=.git/ --exclude=node_modules/ --exclude=.DS_Store'
|
- ssh-keyscan -H $SSH_HOST >> ~/.ssh/known_hosts
|
||||||
when:
|
- |
|
||||||
branch: main
|
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/
|
||||||
|
|
||||||
# Шаг 3: Очистка кэша
|
|
||||||
- name: flush-cache
|
- name: flush-cache
|
||||||
image: appleboy/drone-ssh
|
image: appleboy/drone-ssh
|
||||||
secrets:
|
environment:
|
||||||
- source: prod_ssh_host
|
SSH_HOST:
|
||||||
target: SSH_HOST
|
from_secret: prod_ssh_host
|
||||||
- source: prod_ssh_user
|
SSH_USERNAME:
|
||||||
target: SSH_USERNAME
|
from_secret: prod_ssh_user
|
||||||
- source: prod_ssh_key
|
SSH_KEY:
|
||||||
target: SSH_KEY
|
from_secret: prod_ssh_key
|
||||||
- source: remote_path
|
REMOTE_PATH:
|
||||||
target: REMOTE_PATH
|
from_secret: remote_path
|
||||||
settings:
|
settings:
|
||||||
script:
|
script:
|
||||||
- cd $REMOTE_PATH
|
- cd $REMOTE_PATH
|
||||||
- if command -v wp > /dev/null 2>&1; then wp cache flush; fi
|
- if command -v wp > /dev/null 2>&1; then wp cache flush; fi
|
||||||
- touch wp-config.php
|
- touch wp-config.php
|
||||||
when:
|
|
||||||
branch: main
|
|
||||||
|
|||||||
Reference in New Issue
Block a user