forked from SPACE-AXE/pcg-back
-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (29 loc) · 817 Bytes
/
Copy pathdeploy-ec2.yml
File metadata and controls
34 lines (29 loc) · 817 Bytes
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
name: Deploy to EC2
on:
push:
branches:
- main
env:
AWS_DEFAULT_REGION: ap-northeast-2
SSH_PRIVATE_KEY: ${{ secrets.EC2_KEY }}
EC2_IP: ${{ secrets.EC2_PUBLIC_IP }}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up SSH key
run: |
echo "$SSH_PRIVATE_KEY" >> $HOME/key.pem
chmod 400 $HOME/key.pem
- name: SSH into remote server and run commands
run: |
ssh -o StrictHostKeyChecking=no -i $HOME/key.pem ubuntu@$EC2_IP "\
source ~/.nvm/nvm.sh
cd /home/ubuntu/pcg && \
git stash -k -u && \
git pull -f origin main && \
bun i && \
bun run typeorm:migrate:run && \
bun run build"