Skip to content

Backend/shuffle #135 (#142) #68

Backend/shuffle #135 (#142)

Backend/shuffle #135 (#142) #68

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: Set environment variable
run: echo "NODE_ENV=development" >> $GITHUB_ENV
- name: Display environment variable
run: echo "NODE_ENV=${NODE_ENV}"
- 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 ~/citadels/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