Skip to content

Commit

Permalink
Merge branch 'dev' into feat/euna
Browse files Browse the repository at this point in the history
  • Loading branch information
hyo-nu authored Jul 24, 2024
2 parents be552dd + 197ee5c commit 0248801
Show file tree
Hide file tree
Showing 190 changed files with 4,977 additions and 8,666 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/BE_CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ on:

env:
AWS_REGION: ap-northeast-2
ECR_REPOSITORY: t3-back-mainecr
ECS_CLUSTER: t3-back-ecscluster
ECS_CONTAINER: t3-back-maincontainer
ECS_SERVICE: t3-back-mainservice
ECR_REPOSITORY: t3-back-apiecr3
ECS_CLUSTER: t3-back-ecscluster2
ECS_CONTAINER: t3-back-apicontainer3
ECS_SERVICE: t3-back-ecscluster2/t3-back-apiservice3

ECS_TASK_DEFINITION: task-definition.json

S3_BUCKET: t3-back-cicdbucket

permissions:
contents: read
permissions: #github actions bot에게 권한 열기
contents: write
pages: write
id-token: write

jobs:
be-cd:
Expand All @@ -38,7 +40,10 @@ jobs:

- name: Download from S3
run: |
aws s3 cp s3://${{ env.S3_BUCKET }}/server-0.0.1-SNAPSHOT.jar ./server/build/libs/server-0.0.1-SNAPSHOT.jar
aws s3 cp s3://${{ env.S3_BUCKET }}/cmsplus-main-0.0.1-SNAPSHOT.jar ./server/build/libs/cmsplus-main-0.0.1-SNAPSHOT.jar
- name: Inject secure
run: echo "${{ secrets.BE_SECURE_DEV }}" > server/src/main/resources/secure.properties

- name: Replace AWS ID
run: |
Expand Down
17 changes: 1 addition & 16 deletions .github/workflows/BE_CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@ jobs:
run: |
apt-get update && apt-get install -y git-lfs
git lfs install
- name: PR Test Result
uses: EnricoMi/publish-unit-test-result-action@v1
if: ${{ always() }}
with:
files: server/build/test-results/**/*.xml
- name: Copy
run: |
Expand All @@ -61,16 +55,7 @@ jobs:
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
# - name: Track JAR with LFS
# run: |
# cd DEPLOY_FILE/server
# git lfs track "*.jar"
# git add .gitattributes
# git add *.jar
# git commit -m "Track JAR files with LFS"
# cd ../..

- name: Build
run: |
timestamp=$(date +"%Y-%m-%d_%H-%M-%S")
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/BE_PIPELINE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ permissions: #github actions bot에게 권한 열기

env:
AWS_REGION: ap-northeast-2
S3_BUCKET: rlatkdbe3
S3_BUCKET: t3-back-cicdbucket

jobs:
be-pipline:
Expand All @@ -35,4 +35,4 @@ jobs:

- name: Upload to S3
run: |
aws s3 cp DEPLOY_FILE/server/server-0.0.1-SNAPSHOT.jar s3://${{ env.S3_BUCKET }}/server-0.0.1-SNAPSHOT.jar
aws s3 cp DEPLOY_FILE/server/cmsplus-main-0.0.1-SNAPSHOT.jar s3://${{ env.S3_BUCKET }}/cmsplus-main-0.0.1-SNAPSHOT.jar
2 changes: 1 addition & 1 deletion .github/workflows/DEV_TRIGGER.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
uses: atlassian/gajira-transition@master
with:
issue: ${{ steps.issue-key.outputs.issue }}
transition: "검토 완료" #Jira 보드의 워크플로 관리에 있는 이름을 적어야함
transition: "검토 " #Jira 보드의 워크플로 관리에 있는 이름을 적어야함
17 changes: 12 additions & 5 deletions .github/workflows/FE_CD.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
name: FE CD

on:
workflow_run:
workflows: [ "FE PIPELINE" ]
types:
- completed
push:
branches:
- dev
paths:
- 'client/**'

# on:
# workflow_run:
# workflows: [ "FE PIPELINE" ]
# types:
# - completed

permissions: #github actions bot에게 권한 열기
contents: write
Expand All @@ -13,7 +20,7 @@ permissions: #github actions bot에게 권한 열기

env:
AWS_REGION: ap-northeast-2
S3_BUCKET_NAME: rlatkdfe3
S3_BUCKET_NAME: t3-front-bucket

jobs:
fe-cd:
Expand Down
68 changes: 36 additions & 32 deletions .github/workflows/FE_PIPELINE.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,43 @@
name: FE PIPELINE
# name: FE PIPELINE

on:
push:
branches:
- dev
paths:
- 'client/**'
# on:
# push:
# branches:
# - dev
# paths:
# - 'client/**'

permissions: #github actions bot에게 권한 열기
contents: write
pages: write
id-token: write
# permissions:
# contents: write
# pages: write
# id-token: write

jobs:
fe-pipeline:
runs-on: ubuntu-latest
# jobs:
# fe-pipeline:
# runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
# steps:
# - name: Checkout
# uses: actions/checkout@v3

- name: Git Config
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
# - name: Git Config
# run: |
# git config --global user.name 'github-actions[bot]'
# git config --global user.email 'github-actions[bot]@users.noreply.github.com'

- name: LOG
run: |
# - name: LOG
# run: |
# timestamp=$(date +"%Y-%m-%d_%H-%M-%S")
# log_file="DEPLOY_LOG/client/FE_CD_LOG_$timestamp.log"
# mkdir -p DEPLOY_LOG/client
# echo "프론트엔드 배포 로그" >> "$log_file"
# git add "$log_file"
# git commit -m "release: $timestamp FE 배포 완료"
# git push origin dev

timestamp=$(date +"%Y-%m-%d_%H-%M-%S")
log_file="DEPLOY_LOG/client/FE_CD_LOG-$timestamp.log"
mkdir -p DEPLOY_LOG/client
echo "프론트엔드 배포 로그" >> "$log_file"
git fetch origin
git checkout prod || git checkout -b prod
git add "$log_file"
git commit -m "release: $timestamp FE 배포 완료"
git push origin prod --force
# - name: Merge to Prod
# run: |
# git fetch origin
# git checkout prod || git checkout -b prod
# git merge dev
# git push origin prod
15 changes: 15 additions & 0 deletions .github/workflows/IMAGE_RESIZE.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Image Resize

on: pull_request

jobs:
image-resize:
name: calibreapp/image-actions
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@main
- name: Compress Images
uses: calibreapp/image-actions@main
with:
githubToken: ${{ secrets.IMAGE_RESIZE_TOKEN }}
86 changes: 86 additions & 0 deletions .github/workflows/MESSAGING_CICD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Messaging CICD

on:
push:
branches:
- dev
paths:
- 'server-messaging/**'

env:
AWS_REGION: ap-northeast-2
ECR_REPOSITORY: t3-back-messagingecr2
ECS_CLUSTER: t3-back-ecscluster2
ECS_CONTAINER: t3-back-messagingcontainer2
ECS_SERVICE: t3-back-ecscluster2/t3-back-messagingservice2
ECS_TASK_DEFINITION: task-definition-messaging.json

permissions:
contents: read

jobs:
ci-cd:
runs-on: ubuntu-latest
environment: production

steps:
- name: Checkout
uses: actions/checkout@v4

- name: 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: ${{ env.AWS_REGION }}

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- name: Grant Grant Permission
run: chmod +x server-messaging/gradlew

- name: Inject secure
run: echo "${{ secrets.MESSAGING_SECURE_DEV }}" > server-messaging/src/main/resources/secure.properties

- name: Build with Gradle
run: |
cd server-messaging
./gradlew clean build
- name: Replace AWS ID
run: |
sed -i "s/{AWS_ACCOUNT_ID}/${{ secrets.AWS_ACCOUNT_ID }}/g" ${{ env.ECS_TASK_DEFINITION }}
- name: Login ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Push ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: latest
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG ./server-messaging
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Image ID to ECS TASK
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: ${{ env.ECS_TASK_DEFINITION }}
container-name: ${{ env.ECS_CONTAINER }}
image: ${{ steps.build-image.outputs.image }}

- name: Deploy ECS
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: ${{ env.ECS_SERVICE }}
cluster: ${{ env.ECS_CLUSTER }}
wait-for-service-stability: true
86 changes: 86 additions & 0 deletions .github/workflows/PAYMENT_CICD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: PAYMENT CICD

on:
push:
branches:
- dev
paths:
- 'server-payment/**'

env:
AWS_REGION: ap-northeast-2
ECR_REPOSITORY: t3-back-paymentecr2
ECS_CLUSTER: t3-back-ecscluster2
ECS_CONTAINER: t3-back-paymentcontainer2
ECS_SERVICE: t3-back-ecscluster2/t3-back-paymentservice2
ECS_TASK_DEFINITION: task-definition-payment.json

permissions:
contents: read

jobs:
ci-cd:
runs-on: ubuntu-latest
environment: production

steps:
- name: Checkout
uses: actions/checkout@v4

- name: 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: ${{ env.AWS_REGION }}

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- name: Grant Grant Permission
run: chmod +x server-payment/gradlew

- name: Inject secure
run: echo "${{ secrets.PAYMENT_SECURE_DEV }}" > server-payment/src/main/resources/secure.properties

- name: Build with Gradle
run: |
cd server-payment
./gradlew clean build
- name: Replace AWS ID
run: |
sed -i "s/{AWS_ACCOUNT_ID}/${{ secrets.AWS_ACCOUNT_ID }}/g" ${{ env.ECS_TASK_DEFINITION }}
- name: Login ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Push ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: latest
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG ./server-payment
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Image ID to ECS TASK
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: ${{ env.ECS_TASK_DEFINITION }}
container-name: ${{ env.ECS_CONTAINER }}
image: ${{ steps.build-image.outputs.image }}

- name: Deploy ECS
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: ${{ env.ECS_SERVICE }}
cluster: ${{ env.ECS_CLUSTER }}
wait-for-service-stability: true
1 change: 1 addition & 0 deletions DEPLOY_LOG/server/BE_CD_LOG_2024-07-23_10-50-36.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
백엔드 배포 로그
Loading

0 comments on commit 0248801

Please sign in to comment.