Skip to content

Commit

Permalink
Merge pull request #206 from softeerbootcamp4th/chore/#205-main-deploy
Browse files Browse the repository at this point in the history
[Chore] Main 기준으로 배포되도록 수정
  • Loading branch information
sooyeoniya authored Aug 23, 2024
2 parents f82abed + 168c408 commit ac8cf0d
Show file tree
Hide file tree
Showing 453 changed files with 24,506 additions and 203 deletions.
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: Bug report
about: 버그이슈
title: 버그명
labels: fix
assignees: ''

---

## 🖥️ 어떤 버그인가요?

## ❗️ 참고 자료 (선택)
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Feature report
about: 기능이슈
title: 기능명
labels: feat
assignees: ''

---

## 🖥️ 어떤 기능인가요?

## ✏️ 작업 상세 내용

## ❗️ 참고 자료 (선택)
9 changes: 9 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## 🖥️ Preview

close #{issue number}

## ✏️ 한 일

## ❗️ 발생한 이슈 (해결 방안)

## ❓ 논의가 필요한 사항
62 changes: 62 additions & 0 deletions .github/workflows/admin_pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build and Comment

on:
pull_request:
branches:
- main
- dev
paths:
- "admin/**"

jobs:
build-admin:
runs-on: ubuntu-latest
env:
working-directory: ./admin

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

- name: Set up Node.js
uses: actions/setup-node@v2

- name: Install dependencies
run: yarn
working-directory: ${{ env.working-directory }}

- name: Build project
run: yarn build
working-directory: ${{ env.working-directory }}

comment-admin:
needs: build-admin
runs-on: ubuntu-latest
if: always()

steps:
# 성공 시 코멘트
- name: Add a comment on success
if: ${{ needs.build-admin.result == 'success' }}
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '빌드를 성공했습니다! :tada:'
})
# 실패 시 코멘트
- name: Add a comment on failure
if: ${{ needs.build-admin.result == 'failure' }}
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '빌드를 실패했습니다. :x: 자세한 내용은 로그를 참고해주세요.'
})
49 changes: 49 additions & 0 deletions .github/workflows/admin_push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: HybridJGS-FE Main Production

on:
push:
branches:
- main
paths:
- "admin/**"

jobs:
build-and-deploy-admin:
runs-on: ubuntu-latest
env:
working-directory: ./admin
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v2

- 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: ap-northeast-2

# dependency 설치
- name: Install dependencies
run: yarn
working-directory: ${{ env.working-directory }}

- name: Create .env file
run: echo "VITE_API_URL=${{ secrets.VITE_API_URL }}" > ./.env
working-directory: ${{ env.working-directory }}

# build
- name: Build project
run: yarn build
working-directory: ${{ env.working-directory }}

# S3 버킷에 배포
- name: Deploy static site to S3 bucket
run: aws s3 sync ./admin/dist s3://hybridjgs-admin

# CloudFront 삭제
- name: Invalidate CloudFront Cache
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.DEV_AWS_DISTRIBUTION_ID_ADMIN }} --paths '/*'
62 changes: 62 additions & 0 deletions .github/workflows/client_pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build and Comment

on:
pull_request:
branches:
- main
- dev
paths:
- "client/**"

jobs:
build-client:
runs-on: ubuntu-latest
env:
working-directory: ./client

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

- name: Set up Node.js
uses: actions/setup-node@v2

- name: Install dependencies
run: yarn
working-directory: ${{ env.working-directory }}

- name: Build project
run: yarn build
working-directory: ${{ env.working-directory }}

comment-client:
needs: build-client
runs-on: ubuntu-latest
if: always()

steps:
# 성공 시 코멘트
- name: Add a comment on success
if: ${{ needs.build-client.result == 'success' }}
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '빌드를 성공했습니다! :tada:'
})
# 실패 시 코멘트
- name: Add a comment on failure
if: ${{ needs.build-client.result == 'failure' }}
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '빌드를 실패했습니다. :x: 자세한 내용은 로그를 참고해주세요.'
})
52 changes: 52 additions & 0 deletions .github/workflows/client_push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: HybridJGS-FE Main Production

on:
push:
branches:
- main
paths:
- "client/**"

jobs:
build-and-deploy-client:
runs-on: ubuntu-latest
env:
working-directory: ./client

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v2

- 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: ap-northeast-2

# dependency 설치
- name: Install dependencies
run: yarn
working-directory: ${{ env.working-directory }}

- name: Create .env file
run: |
echo "VITE_API_URL=${{ secrets.VITE_API_URL }}" >> ./.env
echo "VITE_RUSH_URL=${{ secrets.VITE_RUSH_URL }}" >> ./.env
working-directory: ${{ env.working-directory }}

# build
- name: Build project
run: yarn build
working-directory: ${{ env.working-directory }}

# S3 버킷에 배포
- name: Deploy static site to S3 bucket
run: aws s3 sync ./client/dist s3://hybridjgs-frontend

# CloudFront 삭제
- name: Invalidate CloudFront Cache
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.DEV_AWS_DISTRIBUTION_ID }} --paths '/*'
Loading

0 comments on commit ac8cf0d

Please sign in to comment.