Skip to content

Commit 8355749

Browse files
committed
feat: Add automated VPS deployment to GitHub Actions
- Add deploy-to-vps job after successful build - Use appleboy/ssh-action for SSH deployment - Pull latest image from GHCR - Restart container with docker-compose - Auto-cleanup old images - Fully automated deployment on every push to master
1 parent 68d1b65 commit 8355749

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,22 @@ jobs:
4848
run: |
4949
echo "Image pushed to ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
5050
echo "Pull command: docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
51+
52+
deploy-to-vps:
53+
needs: build-and-push
54+
runs-on: ubuntu-latest
55+
56+
steps:
57+
- name: Deploy to VPS
58+
uses: appleboy/ssh-action@v1.0.3
59+
with:
60+
host: ${{ secrets.VPS_HOST }}
61+
username: ${{ secrets.VPS_USER }}
62+
key: ${{ secrets.VPS_SSH_KEY }}
63+
script: |
64+
cd ~/app
65+
docker pull ghcr.io/getlumos/docs-lumos:latest
66+
docker-compose down || true
67+
docker-compose up -d
68+
docker image prune -f
69+
echo "Deployment completed successfully!"

0 commit comments

Comments
 (0)