Skip to content

Merge pull request #229 from GSM-MSG/refac/reissue #140

Merge pull request #229 from GSM-MSG/refac/reissue

Merge pull request #229 from GSM-MSG/refac/reissue #140

on:
push:
branches: [ "develop" ]
jobs:
CD:
name: CD
runs-on: ubuntu-latest
environment: production
steps:
- 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_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@v1
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 }}
IMAGE_TAG: latest
run: |
docker build -t ${{ secrets.ECR_REPOSITORY }} .
docker tag ${{ secrets.ECR_REPOSITORY }}:$IMAGE_TAG ${{ secrets.REPO_URL }}:$IMAGE_TAG
docker push ${{ secrets.REPO_URL }}:$IMAGE_TAG
- name : CodeDeploy Create Deployment
run: |
aws deploy create-deployment \
--application-name codedeploy-application \
--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-CD 성공! ✅
webhook: ${{ secrets.SMS_DISCORD_WEBHOOK }}
color: 00FF00
- name: SMS-Backend-CD Discord Notification
uses: sarisia/actions-status-discord@v1
if: ${{ failure() }}
with:
title: ❗️ SMS-Backend-CD 실패! ❗️
webhook: ${{ secrets.SMS_DISCORD_WEBHOOK }}
color: FF0000