Skip to content

Commit 77cf969

Browse files
authored
Merge pull request #72 from ChooseTale/feat/atc/CD
fix: port kill로직과 슬랙 메세지 추가
2 parents d3462bc + 307b3a6 commit 77cf969

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

.github/workflows/auto-cd(dev).yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ env:
1818
SERVER_SSH_PASSPHRASE: ${{ secrets.DEV_SERVER_SSH_PASSPHRASE }}
1919
DEPLOY_PATH: choose-tale/Backend
2020
BRANCH: ${{github.ref_name}}
21+
PORT: IF [ "${{ inputs.dev_command }}" = "yarn dev:test" ]; then 6001; else 5001; fi
2122

2223
jobs:
2324
deploy:
@@ -49,8 +50,19 @@ jobs:
4950
git fetch --all
5051
git pull origin ${{ env.BRANCH }}
5152
yarn install --frozen-lockfile
53+
54+
55+
if [ "${{ inputs.dev_command }}" = "yarn dev:test" ]; then
56+
lsof -ti:6001 | xargs kill -9 || true
57+
elif [ "${{ inputs.dev_command }}" = "yarn dev" ]; then
58+
lsof -ti:5001 | xargs kill -9 || true
59+
fi
5260
${{ inputs.dev_command }}
5361
EOF
5462
63+
- name: 원격 서버에 배포 완료
64+
run: |
65+
curl -X POST -H 'Content-type: application/json' --data '{"text":"배포가 완료되었습니다. port: ${{ env.PORT }} , branch: ${{ env.BRANCH }}"}' $SLACK_WEBHOOK_URL
66+
5567
- name: SSH 키 정리
5668
run: rm -rf ~/.ssh

0 commit comments

Comments
 (0)