-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (31 loc) · 908 Bytes
/
Copy pathdeploy.yaml
File metadata and controls
37 lines (31 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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/work
chmod 600 ~/.ssh/work
ssh-keyscan -p $SSH_PORT $SSH_HOST >> ~/.ssh/known_hosts
scp -i ~/.ssh/work -P $SSH_PORT -r ./dist/* $SSH_USER@$SSH_HOST:~/public_html/wp/join