Skip to content

add github action workflow #3

add github action workflow

add github action workflow #3

Workflow file for this run

name: Deploy React App to cPanel
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: npm install
- name: Build React app
run: npm run build
- name: Deploy files to cPanel via SSH
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SSH_HOST: ${{ secrets.SSH_HOST }}
SSH_USER: ${{ secrets.SSH_USER }}
SSH_PORT: ${{ secrets.SSH_PORT }}
run: |
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/escape_key
chmod 600 ~/.ssh/escape_key
ssh-keyscan -p $SSH_PORT $SSH_HOST >> ~/.ssh/known_hosts
scp -i ~/.ssh/escape_key -P $SSH_PORT -r ./dist/* $SSH_USER@$SSH_HOST:~/escape-sequence.kjsce.hosting.acm.org/