Skip to content

Commit

Permalink
Merge pull request #18 from CSID-DGU/feat/#11-cicd
Browse files Browse the repository at this point in the history
[FEAT] Update CD.yml
  • Loading branch information
bbabbi authored Oct 14, 2024
2 parents c85e05b + 3bd2767 commit dec5aef
Showing 1 changed file with 16 additions and 33 deletions.
49 changes: 16 additions & 33 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# 워크플로우의 이름 지정
name: CD

# 해당 workflow가 언제 실행될 것인지에 대한 트리거를 지정
on:
push:
branches: [ develop ] # develop branch로 push 될 때 실행됩니다.
branches: [ develop ]

env:
S3_BUCKET_NAME: cecd1921-bucket
Expand Down Expand Up @@ -50,39 +49,25 @@ jobs:
shell: bash

- name: Grant execute permission for gradlew
run: |
cd server
chmod +x gradlew
run: chmod +x gradlew

- name: Build with Gradle # 실제 application build(-x 옵션을 통해 test는 제외)
run: |
cd server
./gradlew build -x test
run: ./gradlew build -x test

- name: Make Directory
run: |
cd server
mkdir -p deploy
run: mkdir -p deploy

- name: Copy Jar
run: |
cd server
cp ./build/libs/*.jar ./deploy
run: cp ./build/libs/*.jar ./deploy

- name: Copy appspec.yml
run: |
cd server
cp appspec.yml ./deploy
run: cp appspec.yml ./deploy

- name: Copy script
run: |
cd server
cp ./scripts/*.sh ./deploy
run: cp ./scripts/*.sh ./deploy

- name: Make zip file
run: |
cd server
zip -r ./cecd-1921.zip ./deploy
run: zip -r ./cecd-1921.zip ./deploy
shell: bash

- name: Configure AWS credentials
Expand All @@ -93,19 +78,17 @@ jobs:
aws-region: ap-northeast-2

- name: Upload to S3
run: |
cd server
aws s3 cp --region ap-northeast-2 ./cecd-1921.zip s3://$S3_BUCKET_NAME/
run: aws s3 cp --region ap-northeast-2 ./cecd-1921.zip s3://$S3_BUCKET_NAME/

- name: Deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_KEY }}
run: |
cd server
aws deploy create-deployment
--application-name cecd-1921-deploy
--deployment-group-name cecd-1921-deploy
--file-exists-behavior OVERWRITE
--s3-location bucket=$S3_BUCKET_NAME,bundleType=zip,key=cecd-1921.zip
aws deploy create-deployment \
--application-name cecd-1921-deploy \
--deployment-group-name cecd-1921-deploy \
--file-exists-behavior OVERWRITE \
--s3-location bucket=$S3_BUCKET_NAME,bundleType=zip,key=cecd-1921.zip \
--region ap-northeast-2
shell: bash

0 comments on commit dec5aef

Please sign in to comment.