-
Notifications
You must be signed in to change notification settings - Fork 5
35 lines (27 loc) · 992 Bytes
/
run-server.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
name: Deploy to Server
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout codecs
uses: actions/checkout@v2
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: 'test'
- name: Adding Known Hosts
run: ssh-keyscan -H ${{ secrets.REMOTE_HOST }} >> ~/.ssh/known_hosts
- name: Update Git code on the servers
run: |
ssh ${{ secrets.REMOTE_USERNAME }}@${{ secrets.REMOTE_HOST }} "ls"
- name: Install dependencies
run: |
ssh ${{ secrets.REMOTE_USERNAME }}@${{ secrets.REMOTE_HOST }} "cd /home/ubuntu/devops_class/all_in_docker/client && npm install"
- name: Start the Node.js application
run: |
ssh ${{ secrets.REMOTE_USERNAME }}@${{ secrets.REMOTE_HOST }} "cd /home/ubuntu/devops_class/all_in_docker && npm start"