Merge pull request #315 from boostcampwm-2024/develop #4
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 Main API-Server | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "Backend/apps/api/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: 서버 배포 | |
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/api/deploy.sh || exit 2 | |
/lico/Backend/server/api/deploy.sh main | |
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": "main", | |
"result": "${{ env.DEPLOY_RESULT }}" | |
}' ${{ secrets.WEBHOOK_URL }} |