Skip to content

Commit

Permalink
Merge pull request #6 from STUDIO-EYE/develop
Browse files Browse the repository at this point in the history
[DEPLOY]
  • Loading branch information
phonil authored Apr 14, 2024
2 parents 494a1bd + 33f9bf7 commit 2ce5ee3
Show file tree
Hide file tree
Showing 33 changed files with 644 additions and 442 deletions.
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/이슈-생성-템플릿.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: 이슈 생성 템플릿
about: 해당 이슈 템플릿을 사용해 이슈를 생성해주세요.
title: ''
labels: ''
assignees: ibaesuyeon

---

## 📄 이슈 내용
<!-- 이슈 내용 요약 설명 -->


## 📑 상세 내용
<!-- 이슈 내용 구현 관련 상세 내용, 기타 내용 작성 -->


## ✔ 체크리스트
<!-- 작업한 내용을 적고 완료했다면 []안에 x를 넣어주세요! -->
- []
- []


## 📍 Reference
<!-- 개발 중 참고한 레퍼런스, 팀원들도 읽어두면 좋은 글이 있다면 링크를 달아주세요! -->
-
77 changes: 77 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: CI and Deploy to Amazon EC2

on:
# Triggers the workflow on push events but only for the "main" branch
push:
branches: [ "main", "develop" ]

# 본인이 설정한 값을 여기서 채워넣습니다.
# 리전, 버킷 이름, CodeDeploy 앱 이름, CodeDeploy 배포 그룹 이름
env:
AWS_REGION: ap-northeast-2
S3_BUCKET_NAME: github-actions-s3-management
CODE_DEPLOY_APPLICATION_NAME: codedeploy-management-app
CODE_DEPLOY_DEPLOYMENT_GROUP_NAME: codedeploy-deployment-group

permissions:
contents: read

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: production

steps:
# (1) 기본 체크아웃
- name: Checkout
uses: actions/checkout@v3

# (2) JDK 17 세팅
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

## create application-rds.yml && application-s3.yml && application-auth.yml && forbidden-words.txt
- name: create application.properties file
run: |
touch ./src/main/resources/application-prod.yml
echo "${{ secrets.DATABASE_YML }}" | base64 --decode > src/main/resources/application-prod.yml
#추가
- name: Make Gradle Wrapper script executable
run: chmod +x /home/runner/work/STUDIO-EYE-MANAGEMENT-SERVICE/STUDIO-EYE-MANAGEMENT-SERVICE/gradlew

# (3) Gradle build (Test 제외)
- name: Build with Gradle
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
with:
arguments: clean build -x test

# (4) AWS 인증 (IAM 사용자 Access Key, Secret Key 활용)
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

# (5) 빌드 결과물을 S3 버킷에 업로드
- name: Upload to AWS S3
run: |
aws deploy push \
--application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \
--ignore-hidden-files \
--s3-location s3://$S3_BUCKET_NAME/$GITHUB_SHA.zip \
--source .
# (6) S3 버킷에 있는 파일을 대상으로 CodeDeploy 실행
- name: Deploy to AWS EC2 from S3
run: |
aws deploy create-deployment \
--application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--deployment-group-name ${{ env.CODE_DEPLOY_DEPLOYMENT_GROUP_NAME }} \
--s3-location bucket=$S3_BUCKET_NAME,key=$GITHUB_SHA.zip,bundleType=zip
77 changes: 0 additions & 77 deletions .github/workflows/gradle-cd.yml

This file was deleted.

82 changes: 0 additions & 82 deletions .github/workflows/gradle-ci.yml

This file was deleted.

46 changes: 46 additions & 0 deletions .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build

on:
push:
branches:
- main
- develop

jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions: read-all
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17

- name: Cache SonarQube packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache Gradle packages
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle

#추가
- name: Make Gradle Wrapper script executable
run: chmod +x ./gradlew

- name: Build and analyze
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
run: ./gradlew build -x test sonar --info
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ out/
.vscode/

### application.yml ###
application.yml
application-local.yml
application-prod.yml
application-test.yml
4 changes: 0 additions & 4 deletions Dockerfile

This file was deleted.

23 changes: 23 additions & 0 deletions appspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: 0.0
os: linux

files:
- source: /
destination: /home/ubuntu/app
overwrite: yes

permissions:
- object: /
pattern: "**"
owner: ubuntu
group: ubuntu

hooks:
AfterInstall:
- location: scripts/stop.sh
timeout: 60
runas: root
ApplicationStart:
- location: scripts/start.sh
timeout: 60
runas: root
Loading

0 comments on commit 2ce5ee3

Please sign in to comment.