-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (39 loc) · 1.2 KB
/
ci.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
33
34
35
36
37
38
39
40
41
42
43
44
name: Deploy
on:
push:
branches:
- master
paths:
- 'client/**'
- 'server/**'
jobs:
deploy_client:
runs-on: ubuntu-latest
if: contains(github.event.head_commit.modified, 'client/')
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: SSH and deploy
env:
SSH_PRIVATE_KEY: ${{secrets.SSH_PRIVATE_KEY}}
run: |
echo "$SSH_PRIVATE_KEY" > keyfile
chmod 600 keyfile
mkdir -p ~/.ssh
cp known_hosts ~/.ssh/known_hosts
ssh -t -i keyfile ubuntu@ec2-13-127-105-158.ap-south-1.compute.amazonaws.com "sudo bash ~/deploy-client.sh"
deploy_server:
runs-on: ubuntu-latest
if: contains(github.event.head_commit.modified, 'server/')
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: SSH and deploy
env:
SSH_PRIVATE_KEY: ${{secrets.SSH_PRIVATE_KEY}}
run: |
echo "$SSH_PRIVATE_KEY" > keyfile
chmod 600 keyfile
mkdir -p ~/.ssh
cp known_hosts ~/.ssh/known_hosts
ssh -t -i keyfile ubuntu@ec2-13-127-105-158.ap-south-1.compute.amazonaws.com "sudo bash ~/deploy-server.sh"