diff --git a/.woodpecker.yml b/.woodpecker.yml index b0caef5..b2dd69b 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,23 +1,35 @@ when: branch: main - event: push + event: [push, manual] steps: - install: + install-client: image: node:20 commands: - - npm ci + - cd client && npm install - build: + build-client: image: node:20 commands: - - npm run build - depends_on: [install] + - cd client && npm run build + depends_on: [install-client] deploy: image: alpine:latest + environment: + DEPLOY_KEY: + from_secret: deploy_key commands: - - apk add --no-cache openssh rsync - - rsync -e "ssh -i /ssh/deploy_key" -avz --delete dist/ root@192.168.1.18:/var/www/ - secrets: [deploy_key] - depends_on: [build] + - apk add --no-cache openssh + - mkdir -p /ssh + - echo "$DEPLOY_KEY" > /ssh/deploy_key + - chmod 600 /ssh/deploy_key + - ssh -i /ssh/deploy_key -o StrictHostKeyChecking=no root@192.168.1.80 ' + cd /opt/min-chat && + git pull origin main && + cd server && npm install --omit=dev && cd .. && + cd client && npm install && npm run build && cd .. && + cp -r client/dist/* /var/www/html/ 2>/dev/null || true && + systemctl restart chat-app + ' + depends_on: [build-client]