Skip to content

Feat : CICD 구축

Feat : CICD 구축 #4

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches:
- develop
- 3-be-cicd-구축
pull_request:
branches:
- develop
- 3-be-cicd-구축
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "adopt"
cache: gradle
# Github actions 워크플로우 내에서 파일에 실행 권한을 부여
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
# 여기서부터 배포
# 빌드한 프로젝트를 압축
- name: Zip entire project directory
run: zip -r likelion12-backend *
# S3 버킷에 위에서 한 압축파일을 복사함
- name: Deliver to AWS S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
aws s3 cp \
--region ap-northeast-2 \
--acl private \
likelion12-backend.zip s3://likelion12-backend-bucket/
- name: Deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
aws deploy create-deployment \
--application-name likelion12-application \
--deployment-group-name codeDeploy-group \
--s3-location bucket=likelion12-backend-bucket,bundleType=zip,key=likelion12-backend.zip \
--region ap-northeast-2