Skip to content

Commit

Permalink
Update CI.yml
Browse files Browse the repository at this point in the history
CI 속도 향상을 위한 빌드 캐시코드 추가
youngreal authored Nov 1, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 6fad7cb commit 1c1739b
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -31,27 +31,41 @@ jobs:
contents: read

steps:
# 체크아웃
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
#JDK 17 설정
java-version: '17'
distribution: 'corretto'

#빌드 캐시
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-

#gradlew 파일에 실행 권한 부여
- name: Grant execute permission to gradlew
run: chmod +x ./gradlew

#todo build + test

#프로젝트 빌드
- name: Build Project
run: ./gradlew clean build -x test

#AWS 자격증명 설정
- name: Setup AWS credential
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_S3_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_S3_SECRET_KEY }}
aws-region: ap-northeast-2

#ZIP 파일을 S3 버킷에 업로드
- name: Upload to AWS S3
run: |
@@ -60,11 +74,12 @@ jobs:
--ignore-hidden-files \
--s3-location s3://$AWS_S3_BUCKET/cicdtest/$GITHUB_SHA.zip \
--source .
#업로드된 ZIP 파일을 CodeDeploy로 배포
- name: AWS Code Deploy
run: |
aws deploy create-deployment \
--application-name ${{ env.AWS_CODE_DEPLOY_APPLICATION }} \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--deployment-group-name ${{ env.AWS_CODE_DEPLOY_GROUP }} \
--s3-location bucket=$AWS_S3_BUCKET,bundleType=zip,key=cicdtest/$GITHUB_SHA.zip
--s3-location bucket=$AWS_S3_BUCKET,bundleType=zip,key=cicdtest/$GITHUB_SHA.zip

0 comments on commit 1c1739b

Please sign in to comment.