This repository has been archived by the owner on Apr 16, 2024. It is now read-only.
Deploy to production server #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .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 |