Skip to content

Migrate Deployment Env (#121) #56

Migrate Deployment Env (#121)

Migrate Deployment Env (#121) #56

name: React CD
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 18
- name: Move to workspace
run: |
mv packages/frontend $GITHUB_WORKSPACE
- name: Deploy to Server
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
REMOTE_HOST: ${{ secrets.HOST }}
REMOTE_USER: ${{ secrets.USERNAME }}
TARGET: ${{ secrets.TARGET_DIR }}
- name: Executing remote ssh commands using ssh key
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
port: ${{ secrets.PORT }}
script: |
cd /webApp/frontend
sudo docker stop react-container
sudo docker rm react-container
sudo docker rmi react-image
sudo docker build --no-cache -t react-image .
sudo docker run --name react-container -d -p 3001:3001 react-image