Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Deploy to VPS

Deploy to VPS #6

Workflow file for this run

name: Deploy to VPS
on:
workflow_run:
workflows: ["Docker Image CI"]
types:
- completed
jobs:
deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Deploy to VPS
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_IP_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
script: |
echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
docker stop eureka_server || true
docker rm eureka_server || true
docker rmi ${{ secrets.DOCKERHUB_REPOSITORY }}:latest || true
docker pull ${{ secrets.DOCKERHUB_REPOSITORY }}:latest
docker run -d --network host --name eureka_server \
-e SPRING_PROFILES_ACTIVE=prod \
-e eureka.environment=prod \
${{ secrets.DOCKERHUB_REPOSITORY }}:latest