Skip to content

choyoungwoo9 is deploying DevServer #155

choyoungwoo9 is deploying DevServer

choyoungwoo9 is deploying DevServer #155

Workflow file for this run

name: Dev Server Backend/Frontend CD
run-name: ${{ github.actor }} is deploying DevServer
on:
workflow_dispatch:
pull_request:
paths:
- 'backend/**'
- 'frontend/**'
types:
- closed
branches:
- dev
jobs:
dev_deploy:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Filter Backend/Frontend
uses: dorny/[email protected]
id: changes
with:
filters: |
backend:
- 'backend/**'
frontend:
- 'frontend/**'
- name: Install sshpass
run: sudo apt-get install -y sshpass
- name: DevServer Backend CD
if: steps.changes.outputs.backend == 'true'
env:
SSH_DEV_DEVELOPER_PASSWORD: ${{ secrets.SSH_DEV_DEVELOPER_PASSWORD }}
DEV_GITHUB_CLIENT_ID: ${{ secrets.DEV_GITHUB_CLIENT_ID }}
DEV_GITHUB_CLIENT_SECRETS: ${{ secrets.DEV_GITHUB_CLIENT_SECRETS }}
DEV_MYSQL_USER: ${{ secrets.DEV_MYSQL_USER }}
DEV_MYSQL_PASSWORD: ${{ secrets.DEV_MYSQL_PASSWORD }}
DEV_MYSQL_DATABASE: ${{ secrets.DEV_MYSQL_DATABASE }}
JWT_SECRET: ${{ secrets.DEV_JWT_SECRET }}
run: |
sshpass -p $SSH_DEV_DEVELOPER_PASSWORD \
ssh -o "StrictHostKeyChecking=no" [email protected] \
"cd /home/developer/web10-Lesser && git pull && \
GITHUB_CLIENT_ID=$DEV_GITHUB_CLIENT_ID \
GITHUB_CLIENT_SECRETS=$DEV_GITHUB_CLIENT_SECRETS \
DEV_MYSQL_USER=$DEV_MYSQL_USER \
DEV_MYSQL_PASSWORD=$DEV_MYSQL_PASSWORD \
DEV_MYSQL_DATABASE=$DEV_MYSQL_DATABASE \
JWT_SECRET=$JWT_SECRET \
docker compose -f docker-compose.dev.yml up -d --build backend"
- name: DevServer frontend CD
if: steps.changes.outputs.frontend == 'true' && always()
env:
SSH_DEV_DEVELOPER_PASSWORD: ${{ secrets.SSH_DEV_DEVELOPER_PASSWORD }}
run: |
sshpass -p $SSH_DEV_DEVELOPER_PASSWORD ssh -o "StrictHostKeyChecking=no" [email protected] "cd /home/developer/web10-Lesser && git pull && docker compose -f docker-compose.dev.yml up -d --build frontend"