-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (51 loc) · 1.61 KB
/
main.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
52
53
54
55
56
57
58
59
60
name: Deploy to AWS Lightsail
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.cache/yarn
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Node.js and yarn
uses: actions/setup-node@v2
with:
node-version: '14.x'
- name: Install dependencies and build app
run: |
yarn install --frozen-lockfile
yarn build
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.LIGHTSAIL_PRIVATE_KEY }}
name: lightsail
known_hosts: ${{ secrets.KNOWN_HOSTS_OF_BASTION }}
- name: Copy build files to remote server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.LIGHTSAIL_IP }}
username: ${{ secrets.LIGHTSAIL_USERNAME }}
port: 22
key: ${{ secrets.LIGHTSAIL_PRIVATE_KEY }}
source: '.next/*'
target: '/home/bitnami/apps/WiiQare-FE'
- name: SSH into remote server and restart the application
uses: appleboy/[email protected]
with:
host: ${{ secrets.LIGHTSAIL_IP }}
username: ${{ secrets.LIGHTSAIL_USERNAME }}
port: 22
key: ${{ secrets.LIGHTSAIL_PRIVATE_KEY }}
script: |
cd /home/bitnami/apps/WiiQare-FE
pm2 restart 0 --update-env