generated from GSM-MSG/MSG-Repository-Generator
-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (85 loc) · 3.33 KB
/
sms_backend_develop_cd.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Deploy to Develop server
on:
push:
branches:
- develop
jobs:
CD:
name: CD
runs-on: ubuntu-latest
environment: production
steps:
- name: SMS-Backend-CD Discord Notification
uses: sarisia/actions-status-discord@v1
if: ${{ success() }}
with:
title: ℹ️ SMS-Backend-Develop-CD 시작! ℹ️
webhook: ${{ secrets.SMS_DISCORD_WEBHOOK }}
color: 00FF00
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Create application.yml
run: |
touch ./sms-infrastructure/src/main/resources/application.yml
echo "${{ secrets.SMS_BACKEND_DEV_ENV }}" > ./sms-infrastructure/src/main/resources/application.yml
shell: bash
- name: Run build with Gradle wrapper
run: ./gradlew clean build
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v3
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
docker build -t ${{ secrets.ECR_REPOSITORY }}:${{ secrets.DEVELOP_IMAGE_TAG }} .
docker tag ${{ secrets.ECR_REPOSITORY }}:${{ secrets.DEVELOP_IMAGE_TAG }} ${{ secrets.REPO_URL }}:${{ secrets.DEVELOP_IMAGE_TAG }}
docker push ${{ secrets.REPO_URL }}:${{ secrets.DEVELOP_IMAGE_TAG }}
# - name : CodeDeploy Create Deployment
# run: |
# aws deploy create-deployment \
# --application-name codedeploy-develop-server \
# --deployment-group-name codedeploy-group \
# --deployment-config-name CodeDeployDefault.OneAtATime \
# --github-location repository=${{ github.repository }},commitId=${{ github.sha }}
- name: SMS-Backend-CD Discord Notification
uses: sarisia/actions-status-discord@v1
if: ${{ success() }}
with:
title: ✅ SMS-Backend-Develop-CD 성공! ✅
webhook: ${{ secrets.SMS_DISCORD_WEBHOOK }}
status: ${{ job.status }}
image: ${{ secrets.CD_SUCCESS_IMAGE }}
description: 영역전개 CD 성공
color: 00FF00
username: SMS CD 봇
url: https://github.com/GSM-MSG/SMS-BackEnd
- name: SMS-Backend-CD Discord Notification
uses: sarisia/actions-status-discord@v1
if: ${{ failure() }}
with:
title: ❗️ SMS-Backend-Develop-CD 실패! ❗️
webhook: ${{ secrets.SMS_DISCORD_WEBHOOK }}
status: ${{ job.status }}
image: ${{ secrets.CD_FAIL_IMAGE }}
description: 무례하긴, 실패다.
color: FF0000
username: SMS CD 봇
url: https://github.com/GSM-MSG/SMS-BackEnd