Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/ci-cd-v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: CI/CD Pipeline

# main 브랜치에 push 또는 pull request가 발생할 때 실행
# feature/{feature-name} : 새로운 기능이나 버그 수정 작업 브랜치
on:
push:
branches:
- main
- feat/**
pull_request:
branches:
- main

env:
PROJECT_NAME: nostroke
BUCKET_NAME: nostroke-dev-bucket
CODE_DEPLOY_APP_NAME: NoStrokeCodeDeployApplication
DEPLOYMENT_GROUP_NAME: nostroke-deploy-group

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'

# gradlew 파일 실행권한 설정
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew

# 빌드 시작
- name: Build with Gradle
run: ./gradlew build

# 프로젝트 zip파일로 압축
- name: Make Zip File
run: zip -qq -r ./$GITHUB_SHA.zip .

# aws 접근 id, key
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2

# s3에 압축한 zip파일 업로드
- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://$BUCKET_NAME/$PROJECT_NAME/$GITHUB_SHA.zip

# s3에 업로드한 파일 code Deploy에서 배포 요청
# Deploy with AWS CodeDeploy
- name: Deploy with AWS CodeDeploy
run: |
aws deploy create-deployment \
--application-name $CODE_DEPLOY_APP_NAME \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--deployment-group-name $DEPLOYMENT_GROUP_NAME \
--s3-location bucket=$BUCKET_NAME,bundleType=zip,key=$PROJECT_NAME/$GITHUB_SHA.zip
74 changes: 0 additions & 74 deletions .github/workflows/ci-cd.yml

This file was deleted.