-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (37 loc) · 1.2 KB
/
chats-deploy.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
name: Deploy Chats-Server
on:
push:
branches:
- develop
paths:
- "Backend/apps/chats/src/**"
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: 코드 체크아웃
uses: actions/checkout@v4
- name: SSH 에이전트 설정
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.API_SERVER_SSH }}
- name: 브랜치 이름 저장
run: echo "BRANCH_NAME=${{ github.ref_name }}" >> $GITHUB_ENV
- name: 서버 배포
id: deploy
continue-on-error: true
run: |
set -o pipefail
ssh -o StrictHostKeyChecking=no ${{ secrets.API_USER_NAME }}@${{ secrets.API_SERVER_ADDRESS }} << 'EOF'
chmod +x /lico/Backend/server/chats/deploy.sh || exit 2
/lico/Backend/server/chats/deploy.sh "$BRANCH_NAME"
EOF
ssh_exit_code=$?
echo "DEPLOY_RESULT=$ssh_exit_code" >> $GITHUB_ENV
exit "$ssh_exit_code"
- name: 결과 전송
run: |
curl -X POST -H "Content-Type: application/json" -d '{
"server": "chats",
"result": "${{ env.DEPLOY_RESULT }}"
}' ${{ secrets.WEBHOOK_URL }}