-
Notifications
You must be signed in to change notification settings - Fork 86
51 lines (49 loc) · 1.57 KB
/
deploy-master.yml
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: React Demo Deploy Master
on:
push:
# Sequence of patterns matched against refs/heads
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.18.1
- run: yarn w3o-latest-prod
- run: yarn build
env:
NODE_OPTIONS: "--max_old_space_size=8192"
CI: false
- run: touch .env
- run: echo "REACT_APP_GOOGLE_ANALYTICS_ID=$REACT_APP_GOOGLE_ANALYTICS_ID" > .env
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/deploy.key
chmod 600 ~/.ssh/deploy.key
cat >>~/.ssh/config <<END
Host deploy
HostName $SSH_HOST
User $SSH_USER
IdentityFile ~/.ssh/deploy.key
StrictHostKeyChecking no
END
env:
SSH_USER: ${{ secrets.EC2_PROD_USER }}
SSH_KEY: ${{ secrets.ssh_private_key }}
SSH_HOST: ${{ secrets.EC2_PROD_IP }}
- run: ssh deploy "ls && cd reactdemo && ls"
- name: Copying files to server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.EC2_PROD_IP }}
username: ${{ secrets.EC2_PROD_USER }}
key: ${{ secrets.ssh_private_key }}
source: "./build/*"
target: "reactdemo"
# Moves content from build folder out so you dont end up with reactdemo/build/...
strip_components: 1
- run: ssh deploy "sh /home/ubuntu/move.sh reactdemo"