-
Notifications
You must be signed in to change notification settings - Fork 2
51 lines (43 loc) · 1.29 KB
/
deployement-pipeline.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
name: "EC2 Deployment Pipeline"
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
concurrency:
group: main-deployment
cancel-in-progress: true
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install Dependencies
run: pnpm install --no-optional
- name: Lint the server code
run: pnpm run lint:server
- name: SSH into EC2 and Deploy
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.EC2_PORT }}
script: |
cd /home/${{ secrets.EC2_USERNAME }}/chatify
sudo git pull origin main
# Añadir el PATH a pnpm y pm2
export PATH=$PATH:/home/ubuntu/.local/share/pnpm:/run/user/1000/fnm_multishells/12656_1717970489054/bin
pnpm install
pnpm run build:server
pm2 restart index --update-env