Skip to content

Commit 31597cc

Browse files
authored
Merge pull request #385 from GSM-MSG/ops/cd-test
๐Ÿ”€ :: code-deploy๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š์Œ์œผ๋กœ ์ธํ•œ CD ์Šคํฌ๋ฆฝํŠธ ์ˆ˜์ •
2 parents 0cb84ab + 7595b26 commit 31597cc

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

โ€Ž.github/workflows/sms_backend_master_cd.yml

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1+
name: sms-production-CD
2+
13
on:
24
push:
35
branches: [ "master" ]
4-
workflow_dispatch:
56

67
jobs:
7-
CD:
8-
name: CD
8+
cd:
99
runs-on: ubuntu-latest
1010
environment: production
1111

1212
steps:
1313
- name: SMS-Backend-CD Discord Notification
1414
uses: sarisia/actions-status-discord@v1
15-
if: ${{ success() }}
1615
with:
1716
title: โ„น๏ธ SMS-Backend-CD ์‹œ์ž‘! โ„น๏ธ
1817
webhook: ${{ secrets.SMS_DISCORD_WEBHOOK }}
@@ -63,30 +62,34 @@ jobs:
6362
docker tag ${{ secrets.ECR_REPOSITORY }}:${{ secrets.IMAGE_TAG }} ${{ secrets.REPO_URL }}:${{ secrets.IMAGE_TAG }}
6463
docker push ${{ secrets.REPO_URL }}:${{ secrets.IMAGE_TAG }}
6564
66-
- name : CodeDeploy Create Deployment
67-
run: |
68-
aws deploy create-deployment \
69-
--application-name codedeploy-application \
70-
--deployment-group-name codedeploy-group \
71-
--deployment-config-name CodeDeployDefault.OneAtATime \
72-
--github-location repository=${{ github.repository }},commitId=${{ github.sha }}
65+
- name: Execute remote SSH
66+
uses: appleboy/ssh-action@master
67+
with:
68+
host: ${{ secrets.REMOTE_SSH_HOST }}
69+
username: ${{ secrets.REMOTE_SSH_USERNAME }}
70+
key: ${{ secrets.REMOTE_SSH_KEY }}
71+
port: ${{ secrets.REMOTE_SSH_PORT }}
72+
script: |
73+
aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin ${{secrets.ECR_REPO_PATH}}
74+
docker pull ${{ secrets.REPO_URL }}:${{ secrets.IMAGE_TAG }}
75+
docker compose restart
7376
74-
- name: SMS-Backend-CD Discord Notification
77+
- name: SMS-Backend-CD Discord Notification (Success)
7578
uses: sarisia/actions-status-discord@v1
76-
if: ${{ success() }}
79+
if: success()
7780
with:
7881
title: โœ… SMS-Backend-CD ์„ฑ๊ณต! โœ…
7982
webhook: ${{ secrets.SMS_DISCORD_WEBHOOK }}
8083
status: ${{ job.status }}
8184
image: ${{ secrets.CD_SUCCESS_IMAGE }}
82-
description: ์˜์—ญ์ „๊ฐœ CD ์„ฑ๊ณต
85+
description: ํ”„๋กœ๋•์…˜ CD ์„ฑ๊ณต
8386
color: 00FF00
8487
username: SMS CD ๋ด‡
8588
url: https://github.com/GSM-MSG/SMS-BackEnd
8689

87-
- name: SMS-Backend-CD Discord Notification
90+
- name: SMS-Backend-CD Discord Notification (Failure)
8891
uses: sarisia/actions-status-discord@v1
89-
if: ${{ failure() }}
92+
if: failure()
9093
with:
9194
title: โ—๏ธ SMS-Backend-CD ์‹คํŒจ! โ—๏ธ
9295
webhook: ${{ secrets.SMS_DISCORD_WEBHOOK }}
@@ -95,4 +98,4 @@ jobs:
9598
description: ๋ฌด๋ก€ํ•˜๊ธด, ์‹คํŒจ๋‹ค.
9699
color: FF0000
97100
username: SMS CD ๋ด‡
98-
url: https://github.com/GSM-MSG/SMS-BackEnd
101+
url: https://github.com/GSM-MSG/SMS-BackEnd

0 commit comments

Comments
ย (0)