Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Deploy to production server #5

Deploy to production server

Deploy to production server #5

Workflow file for this run

# .github/workflows/deploy.yml
name: Deploy to production server
on:
workflow_run:
workflows: ["Build and push to DockerHub"]
branches: ["main"]
types:
- completed
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Copy docker-compose.production.yml via ssh
uses: appleboy/scp-action@master
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USERNAME }}
password: ${{ secrets.DEPLOY_PASSWORD }}
port: ${{ secrets.DEPLOY_PORT }}
source: "docker-compose.production.yml"
target: "demo-gateway"
- name: Executing remote ssh commands to deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USERNAME }}
password: ${{ secrets.DEPLOY_PASSWORD }}
port: ${{ secrets.DEPLOY_PORT }}
script: |
cd demo-gateway
docker compose -f docker-compose.production.yml pull
docker compose -f docker-compose.production.yml down
docker compose -f docker-compose.production.yml up -d