test
This commit is contained in:
+22
-10
@@ -1,23 +1,35 @@
|
|||||||
when:
|
when:
|
||||||
branch: main
|
branch: main
|
||||||
event: push
|
event: [push, manual]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
install:
|
install-client:
|
||||||
image: node:20
|
image: node:20
|
||||||
commands:
|
commands:
|
||||||
- npm ci
|
- cd client && npm install
|
||||||
|
|
||||||
build:
|
build-client:
|
||||||
image: node:20
|
image: node:20
|
||||||
commands:
|
commands:
|
||||||
- npm run build
|
- cd client && npm run build
|
||||||
depends_on: [install]
|
depends_on: [install-client]
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
image: alpine:latest
|
image: alpine:latest
|
||||||
|
environment:
|
||||||
|
DEPLOY_KEY:
|
||||||
|
from_secret: deploy_key
|
||||||
commands:
|
commands:
|
||||||
- apk add --no-cache openssh rsync
|
- apk add --no-cache openssh
|
||||||
- rsync -e "ssh -i /ssh/deploy_key" -avz --delete dist/ root@192.168.1.18:/var/www/
|
- mkdir -p /ssh
|
||||||
secrets: [deploy_key]
|
- echo "$DEPLOY_KEY" > /ssh/deploy_key
|
||||||
depends_on: [build]
|
- 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]
|
||||||
|
|||||||
Reference in New Issue
Block a user