Skip to content

feat: gradle 캐시 기능 및 불필요한 파일 s3 업로드시 제거하도록 변경 #327

feat: gradle 캐시 기능 및 불필요한 파일 s3 업로드시 제거하도록 변경

feat: gradle 캐시 기능 및 불필요한 파일 s3 업로드시 제거하도록 변경 #327

Workflow file for this run

name: Execute CD
on:
push:
branches: [ "develop" ]
permissions:
contents: read
env:
BUCKET_NAME: space-club-be-bucket
DIRECTORY_NAME: space-club-be-directory
CODE_DEPLOY_APP_NAME: space-club-be-deploy
DEPLOYMENT_GROUP_NAME: space-club-be-deploy-group
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check Repo code With Submodules
uses: actions/checkout@v3
with:
submodules: 'true'
token: ${{secrets.GH_ACCESS_TOKEN}}
- name: Set encrypt Secret key
run: echo ${{ secrets.encrypt }} > scripts/properties.sh
shell: bash
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Permission for gradlew
run: chmod +x ./gradlew
shell: bash
- name: Gradle Build Action
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25
with:
arguments: bootJar
- name: Make Zip File
run: zip -qq -r ./$GITHUB_SHA.zip .
shell: bash
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v3
with:
aws-access-key-id: ${{ secrets.ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.PRIVATE_KEY }}
aws-region: ap-northeast-2
- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://$BUCKET_NAME/$DIRECTORY_NAME/$GITHUB_SHA.zip
- name: Deploy to EC2 Instance
run: aws deploy create-deployment --application-name $CODE_DEPLOY_APP_NAME --deployment-group-name $DEPLOYMENT_GROUP_NAME --deployment-config-name CodeDeployDefault.OneAtATime --s3-location bucket=$BUCKET_NAME,bundleType=zip,key=$DIRECTORY_NAME/$GITHUB_SHA.zip