Skip to content

Commit

Permalink
�v1.0.0
Browse files Browse the repository at this point in the history
�v1.0.0
  • Loading branch information
mikekks authored Sep 2, 2024
2 parents f624d08 + e5c3c8c commit 9758e19
Show file tree
Hide file tree
Showing 160 changed files with 2,894 additions and 832 deletions.
38 changes: 38 additions & 0 deletions .github/release-drafter-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '🎁 새로운 기능이 추가되었어요'
labels: ['Type: Feature']
- title: '🐞 기존 버그가 수정되었어요'
labels: ['Type: Bug']
- title: '🐬 코드를 개선했어요'
labels:
- 'Type: Improvement'
- 'Type: Chore'
- title: '⚙️ 프로젝트를 개선했어요'
labels:
- 'Type: Infra'
- 'Type: Chore'
- 'Type: Document'
- 'Type: Fix'
- title: '🚀 배포'
labels:
- 'deployment'

change-template: '- $TITLE #$NUMBER @$AUTHOR '
template: |
## 이번 버전의 변경사항은 아래와 같아요
---
$CHANGES
no-changes-template: '변경사항이 없어요'
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: patch
21 changes: 14 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,16 @@ name: BackEnd - CI/CD(build)

on:
pull_request:
branches: [ "main","develop" ]
branches: [ "develop", "release/v**", "main" ]
push:
branches: [ "develop" ]
branches: [ "develop", "release/v**" ]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
# JDK를 17 버전으로 셋팅한다.
Expand All @@ -42,7 +40,7 @@ jobs:
${{ runner.os }}-gradle-
# 프로젝트 저장소에 업로드하면 안되는 설정 파일들을 만들어줍니다.
- name: Make application.yml
- name: Make application.yml & Keys
run: |
# src/main/resources 경로를 이동
cd ./src/main/resources
Expand All @@ -51,8 +49,15 @@ jobs:
touch ./application-dev.yml
# 등록해둔 Github Secrets의 내용을 이용해서 yml 파일의 내용을 써줍니다.
echo "$APPLICATION_DEV" > ./application-dev.yml
# key 폴더 만들고 cloudfront 키 넣기
mkdir key
cd key
touch ./private_key.pem
echo "$CLOUDFRONT_KEY" > ./private_key.pem
env:
APPLICATION_DEV: ${{ secrets.APPLICATION_DEV }}
CLOUDFRONT_KEY: ${{ secrets.CLOUD_FRONT_KEY }}
shell: bash

- name: Gradle 권한 부여
Expand All @@ -63,6 +68,8 @@ jobs:

- name: Discord 알림 봇
uses: sarisia/actions-status-discord@v1
if: always()
if: ${{ failure() }}
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
title: ❗️ Backend CI failed ❗️
webhook: ${{ secrets.DISCORD_WEBHOOK }}
color: FFFF00
90 changes: 56 additions & 34 deletions .github/workflows/deploy.yml → .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,33 @@ name: BackEnd - CI/CD(deploy)

on:
pull_request:
types: [ closed ]
branches: [ "develop" ]
types: [ closed ]


permissions:
contents: read

jobs:
deploy:
deploy-dev:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

environment: develop
env:
DEPLOYMENT_GROUP_NAME: meeteam-dev
S3_BUCKET_DIR_NAME: dev
steps:
- uses: actions/checkout@v3
- name: ✅ Checkout branch
uses: actions/checkout@v3
# JDK를 17 버전으로 셋팅한다.
- name: Set up JDK 17
- name: ⚙️ Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

# Gradle을 캐싱한다 -> 빌드 속도가 증가하는 효과가 있다.
- name: Gradle 캐싱
- name: Gradle 캐싱
uses: actions/cache@v3
with:
path: |
Expand All @@ -41,69 +46,86 @@ jobs:
${{ runner.os }}-gradle-
# 프로젝트 저장소에 업로드하면 안되는 설정 파일들을 만들어줍니다.
- name: Make application.yml & ApproveMail.html
- name: 🗂️ Make config
run: |
# src/main/resources 경로 이동
cd ./src/main/resources
cd ./src/main/resources
# yml 파일 생성
touch ./application-dev.yml
echo "$APPLICATION_DEV" > ./application-dev.yml
touch ./application-dev.yml
echo "$APPLICATION_DEV" > ./application-dev.yml
# 메일 관련된 html 파일 생성
# 키 파일 생성
touch ./private-key.pem
echo "$CLOUD_FRONT_KEY" > ./private-key.pem
# 폴더 생성
mkdir templates
# 메일 관련된 html 파일 생성
cd ./templates
touch ./ApproveMail.html
echo "$MAIL_APPROVE_TEMPLATE" > ./ApproveMail.html
touch ./UniversityAuthMail.html
echo "$MAIL_VERIFY_TEMPLATE" > ./UniversityAuthMail.html
touch ./ApplicationNotificationMail.html
echo "$MAIL_APPLICATION_NOTIFICATION_TEMPLATE" > ./ApplicationNotificationMail.html
env:
APPLICATION_DEV: ${{ secrets.APPLICATION_DEV }}
MAIL_APPROVE_TEMPLATE: ${{ secrets.MAIL_APPROVE_TEMPLATE }}
MAIL_VERIFY_TEMPLATE: ${{ secrets.MAIL_VERIFY_TEMPLATE }}
MAIL_APPLICATION_NOTIFICATION_TEMPLATE: ${{ secrets.MAIL_APPLICATION_NOTIFICATION_TEMPLATE }}
CLOUD_FRONT_KEY: ${{ secrets.CLOUD_FRONT_KEY }}
shell: bash

- name: Gradle 권한 부여
- name: ⚙️ Gradle 권한 부여
run: chmod +x gradlew

- name: Gradle로 빌드 실행
- name: ⚙️ Gradle로 빌드 실행
run: ./gradlew bootjar


# 배포에 필요한 여러 설정 파일과 프로젝트 빌드파일을 zip 파일로 모아줍니다.
- name: zip file 생성
# 배포에 필요한 여러 설정 파일과 프로젝트 빌드파일을 zip 파일로 모아준다.
- name: 📦 zip file 생성
run: |
mkdir deploy
cp ./docker/docker-compose.blue.yml ./deploy/
cp ./docker/docker-compose.green.yml ./deploy/
mkdir deploy/dev
cp ./docker/dev/docker-compose.dev.yml ./deploy/dev
cp ./docker/dev/Dockerfile ./deploy/dev
cp ./src/main/resources/private-key.pem ./deploy/dev
cp ./build/libs/*.jar ./deploy/dev
cp ./appspec.yml ./deploy/
cp ./docker/Dockerfile ./deploy/
cp ./scripts/*.sh ./deploy/
cp ./build/libs/*.jar ./deploy/
zip -r -qq -j ./spring-build.zip ./deploy
cp ./scripts/deploy.sh ./deploy/
zip -r -qq ./spring-app.zip ./deploy

# AWS에 연결해줍니다.
- name: AWS 연결
# AWS에 연결해준다.
- name: 🌎 AWS 연결
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: ${{ secrets.AWS_REGION }}

# S3에 프로젝트를 업로드 합니다.
- name: S3에 프로젝트 업로드
# S3에 프로젝트를 업로드 한다.
- name: 🚛 S3에 프로젝트 업로드
run: |
aws s3 cp \
--region ap-northeast-2 \
./spring-build.zip s3://meeteam-backend-bucket
./spring-app.zip s3://${{ secrets.S3_BUCKET_NAME }}/${{ env.S3_BUCKET_DIR_NAME }}/spring-app.zip
# CodeDelploy에 배포를 요청합니다.
- name: Code Deploy 배포 요청
# CodeDelploy에 배포를 요청한다.
- name: 🚀 Code Deploy 배포 요청
run: aws deploy create-deployment --application-name meeteam-app
--deployment-config-name CodeDeployDefault.OneAtATime
--deployment-group-name meeteam-app
--s3-location bucket=meeteam-backend-bucket,bundleType=zip,key=spring-build.zip
--deployment-group-name ${{ env.DEPLOYMENT_GROUP_NAME }}
--s3-location bucket=${{ secrets.S3_BUCKET_NAME }},bundleType=zip,key=${{ env.S3_BUCKET_DIR_NAME }}/spring-app.zip

- name: Discord 알림 봇
uses: sarisia/actions-status-discord@v1
if: always()
if: ${{ failure() }}
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
title: ❗️ Backend CD failed ❗️
webhook: ${{ secrets.DISCORD_WEBHOOK }}
color: FF0000
131 changes: 131 additions & 0 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: BackEnd - CI/CD(deploy)

on:
pull_request:
branches: [ "main" ]
types: [ closed ]


permissions:
contents: read

jobs:
deploy-prod:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
environment: production
env:
DEPLOYMENT_GROUP_NAME: meeteam-app
S3_BUCKET_DIR_NAME: prod
steps:
- name: ✅ Checkout branch
uses: actions/checkout@v3
# JDK를 17 버전으로 셋팅한다.
- name: ⚙️ Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

# Gradle을 캐싱한다 -> 빌드 속도가 증가하는 효과가 있다.
- name: ✅ Gradle 캐싱
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
# 프로젝트 저장소에 업로드하면 안되는 설정 파일들을 만들어줍니다.
- name: 🗂️ Make config
run: |
# src/main/resources 경로 이동
cd ./src/main/resources
# yml 파일 생성
touch ./application-prod.yml
echo "$APPLICATION_PROD" > ./application-prod.yml
# 키 파일 생성
touch ./private-key.pem
echo "$CLOUD_FRONT_KEY" > ./private-key.pem
# 폴더 생성
mkdir templates
# 메일 관련된 html 파일 생성
cd ./templates
touch ./ApproveMail.html
echo "$MAIL_APPROVE_TEMPLATE" > ./ApproveMail.html
touch ./UniversityAuthMail.html
echo "$MAIL_VERIFY_TEMPLATE" > ./UniversityAuthMail.html
touch ./ApplicationNotificationMail.html
echo "$MAIL_APPLICATION_NOTIFICATION_TEMPLATE" > ./ApplicationNotificationMail.html
env:
APPLICATION_PROD: ${{ secrets.APPLICATION_PROD }}
MAIL_APPROVE_TEMPLATE: ${{ secrets.MAIL_APPROVE_TEMPLATE }}
MAIL_VERIFY_TEMPLATE: ${{ secrets.MAIL_VERIFY_TEMPLATE }}
MAIL_APPLICATION_NOTIFICATION_TEMPLATE: ${{ secrets.MAIL_APPLICATION_NOTIFICATION_TEMPLATE }}
CLOUD_FRONT_KEY: ${{ secrets.CLOUD_FRONT_KEY }}
shell: bash

- name: ⚙️ Gradle 권한 부여
run: chmod +x gradlew

- name: ⚙️ Gradle로 빌드 실행
run: ./gradlew bootjar
# 배포에 필요한 여러 설정 파일과 프로젝트 빌드파일을 zip 파일로 모아준다.
- name: 📦 zip file 생성
run: |
mkdir deploy
mkdir deploy/prod
cp ./docker/prod/docker-compose.prod.yml ./deploy/prod
cp ./docker/prod/Dockerfile ./deploy/prod
cp ./src/main/resources/private-key.pem ./deploy/prod
cp ./build/libs/*.jar ./deploy/prod
cp ./scripts/deploy.sh ./deploy/
cp ./appspec.yml ./deploy/
zip -r -qq ./spring-app.zip ./deploy

# AWS에 연결해준다.
- name: 🌎 AWS 연결
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: ${{ secrets.AWS_REGION }}

# S3에 프로젝트를 업로드 한다.
- name: 🚛 S3에 프로젝트 업로드
run: |
aws s3 cp \
--region ap-northeast-2 \
./spring-app.zip s3://${{ secrets.S3_BUCKET_NAME }}/${{ env.S3_BUCKET_DIR_NAME }}/spring-app.zip
# CodeDelploy에 배포를 요청한다.
- name: 🚀 Code Deploy 배포 요청
run: aws deploy create-deployment --application-name meeteam-app
--deployment-config-name CodeDeployDefault.OneAtATime
--deployment-group-name ${{ env.DEPLOYMENT_GROUP_NAME }}
--s3-location bucket=${{ secrets.S3_BUCKET_NAME }},bundleType=zip,key=${{ env.S3_BUCKET_DIR_NAME }}/spring-app.zip

- name: Discord 알림 봇
uses: sarisia/actions-status-discord@v1
if: ${{ failure() }}
with:
title: ❗️ Backend CD failed ❗️
webhook: ${{ secrets.DISCORD_WEBHOOK }}
color: FF0000
Loading

0 comments on commit 9758e19

Please sign in to comment.