Merge pull request #281 from boostcampwm-2024/fix/be/chats #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |