-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (48 loc) · 1.42 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: DDocker to AWS EC2
on:
push:
branches:
- main
jobs:
deploy:
name: Launch Express WAS with pm2
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.15.0]
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 8.10.5
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Get PNPM cache directory
id: pnpm-cache-dir
run: |
echo "::set-output name=dir::$(pnpm config get store-dir)"
- uses: actions/cache@v3
id: pnpm-cache
with:
path: ${{ steps.pnpm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: pnpm install
- name: SSH deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.AWS_SSH_HOST }}
username: ${{ secrets.AWS_SSH_USERNAME }}
password: ${{ secrets.AWS_SSH_PASSWORD }}
key: ${{ secrets.AWS_SSH_KEY }}
port: 22
script: |
sudo su -c 'cd /root/DDocker_BE'
sudo su -c 'git pull origin main'
sudo su -c 'pm2 reload DDocker_API'