Skip to content

신규 AWS 계정으로 변경 #8

신규 AWS 계정으로 변경

신규 AWS 계정으로 변경 #8

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
name: CD
on:
push:
branches: [ "develop" ]
permissions:
contents: read
env:
S3_BUCKET_NAME: coolpeace-s3
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: JDK 17 설치
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Gradle 빌드
run: chmod +x ./gradlew
shell: bash
- name: Spring boot jar 생성
run: ./gradlew build -x test
shell: bash
- name: zip file 생성
run: zip -r ./$GITHUB_SHA.zip .
shell: bash
- name: AWS credentials 설정
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.CICD_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.CICD_SECRET_KEY }}
aws-region: ap-northeast-2
- name: S3에 서버파일 업로드
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://$S3_BUCKET_NAME/$GITHUB_SHA.zip
- name: Deploy
run: |
aws deploy create-deployment \
--region ap-northeast-2 \
--application-name coolpeace-codedeploy \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--deployment-group-name coolpeace-deploy-group \
--file-exists-behavior OVERWRITE \
--s3-location bucket=$S3_BUCKET_NAME,bundleType=zip,key=$GITHUB_SHA.zip