when: branch: main event: [push, manual] steps: install: image: node:20 commands: - cd client && npm install build: image: node:20 commands: - cd client && npm run build depends_on: [install] deploy: image: alpine:latest environment: DEPLOY_KEY: from_secret: deploy_key commands: - apk add --no-cache openssh rsync - 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 ..' - rsync -e "ssh -i /ssh/deploy_key -o StrictHostKeyChecking=no" -avz --delete client/dist/ root@192.168.1.80:/var/www/html/ - ssh -i /ssh/deploy_key -o StrictHostKeyChecking=no root@192.168.1.80 'systemctl restart chat-app' depends_on: [build]