-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (30 loc) · 943 Bytes
/
deploy.yaml
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
name: Deploy App
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
env:
SSH_PRIVATE_KEY: ${{secrets.SSH_KEY}}
SERVER_IP: ${{secrets.SERVER_IP}}
NODE_OPTIONS: --max-old-space-size=2048
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: npm install yarn -g
- name: Build React App
run: |
yarn install
yarn build
- name: Deploy
run: |
which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )
eval $(ssh-agent -s)
ssh-add <(echo "$SSH_PRIVATE_KEY" )
mkdir -p ~/.ssh
chmod 700 ~/.ssh
ssh-keyscan $SERVER_IP >> ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
ssh root@$SERVER_IP 'rm -rf /var/www/html/fantasy.simoen.tech/*'
scp -r build/* root@$SERVER_IP:/var/www/html/fantasy.simoen.tech/