Skip to content

Commit

Permalink
Fix: zip 파일 생성 코드 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
emes-g committed Jul 11, 2024
1 parent 5511238 commit 730658a
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]

workflow_dispatch:
env:
AWS_REGION: ap-northeast-2
Expand Down Expand Up @@ -36,31 +36,35 @@ jobs:
# gradlew 권한 설정
- name: Make gradlew executable
run: chmod +x ./gradlew

# Build Gradle
- name: Build with Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5
with:
arguments: clean build -x test


# zip 파일 생성
- name: Make zip file
run: zip -qq -r ./$GITHUB_SHA.zip .

# AWS 인증
- name: AWS configure 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 }}

# 빌드 결과물 S3 버킷에 업로드
- name: upload to AWS S3
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://$BUCKET_NAME/$PROJECT_NAME/$GITHUB_SHA.zip

- name: deploy with AWS codeDeploy
run: aws deploy create-deployment \
--application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--deployment-group-name ${{ env.CODE_DEPLOY_DEPLOYMENT_GROUP_NAME }} \
--s3-location bucket=$S3_BUCKET_NAME,key=$GITHUB_SHA.zip,bundleType=zip \
--application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--deployment-group-name ${{ env.CODE_DEPLOY_DEPLOYMENT_GROUP_NAME }} \
--s3-location bucket=$S3_BUCKET_NAME,key=$GITHUB_SHA.zip,bundleType=zip \

- name: Test AWS credentials
run: aws s3 ls

0 comments on commit 730658a

Please sign in to comment.