Skip to content

Merge pull request #24 from 9oormthon-univ/feature/review/#23 #47

Merge pull request #24 from 9oormthon-univ/feature/review/#23

Merge pull request #24 from 9oormthon-univ/feature/review/#23 #47

Workflow file for this run

name: Deploy
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
env:
S3_BUCKET_NAME: kongju-s3-bucket
AWS_REGION: ap-northeast-2
CODEDEPLOY_NAME: kongju-actions
CODEDEPLOY_GROUP: kongju-actions-group
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'corretto'
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash
- name: Build with Gradle
run: ./gradlew build
shell: bash
#$GITHUB_SHA : Github Actions에서 제공하는 여러 기본 환경변수 중 하나이며, 현재 workflow를 실행시키는 커밋의 해쉬값
- name: Make zip file
run: zip -r ./$GITHUB_SHA.zip .
shell: bash
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://$S3_BUCKET_NAME/$GITHUB_SHA.zip
- name: Code Deploy
run: aws deploy create-deployment --application-name $CODEDEPLOY_NAME --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name $CODEDEPLOY_GROUP --s3-location bucket=$S3_BUCKET_NAME,bundleType=zip,key=$GITHUB_SHA.zip