-
Notifications
You must be signed in to change notification settings - Fork 1
38 lines (31 loc) · 1.14 KB
/
ec2Deploy.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
name: Deploy to EC2
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.EC2_PEM_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
- name: Add EC2 to known hosts
run: ssh-keyscan -H ec2-43-200-222-157.ap-northeast-2.compute.amazonaws.com >> ~/.ssh/known_hosts
- name: SSH into EC2 and execute deployment script
run: |
ssh -i ~/.ssh/id_rsa [email protected] "cd PICKPLE-client && sh deploy.sh"
- name: Send Slack notification
if: ${{ success() }}
uses: rtCamp/[email protected]
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_MESSAGE: |
:rocket: 배포 완료!
작성자: ${{ github.event.head_commit.author.name }}
메시지: ${{ github.event.head_commit.message }}
:white_check_mark: 서비스가 정상적으로 배포되었습니다. PICKPLE 화이팅!