Skip to content

Commit

Permalink
Merge pull request #1055 from peer-42seoul/main
Browse files Browse the repository at this point in the history
  • Loading branch information
joonseong11 authored Feb 28, 2024
2 parents bc1e301 + e620e7f commit efca9b0
Show file tree
Hide file tree
Showing 430 changed files with 20,639 additions and 5,939 deletions.
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/유저-피드백-기록-템플릿.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: 유저 피드백 기록 템플릿
about: 유저 피드백 기록용 템플릿 입니다.
title: '[개발 코드] 피드백 내용 간략히'
labels: 'user feedback'
assignees: ''
---

#### 문제 상황

#### 유저가 바라는 개선 사항
111 changes: 111 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Main CI/CD

on:
pull_request:
branches: ['main']
types: ['closed']

permissions:
contents: read

jobs:
check-branch:
if: contains(github.head_ref, 'release')
runs-on: ubuntu-latest
steps:
- name: Check branch
run: |
echo "This is a release branch"
check-merged:
needs: check-branch
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Check merged
run: |
echo "This is a merged release branch"
extract-version:
needs: check-merged
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract-version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Extract version
id: extract-version
run: |
echo "version=$(echo "$(git show -s --format=%s)" | egrep -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')" >> "$GITHUB_OUTPUT"
CI:
name: Main Server CI Check
needs: extract-version
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16
- name: Check version
run: |
echo "This release version: ${{ needs.extract-version.outputs.version }}"
- name: Install dependencies
run: npm install
- name: Prettier
run: npm run format
- name: Lint
run: npm run lint
- name: Build Test
run: npm run build

CD:
name: Main Server CD Check
needs: [CI, extract-version]
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Build and push Docker image
run: |
touch .env.production
echo "${{ secrets.MAIN_ENV }}" >> .env.production
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
docker build -f Dockerfile -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.MAIN_DOCKER_IMAGE }}:${{ needs.extract-version.outputs.version }} .
docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.MAIN_DOCKER_IMAGE }}:${{ needs.extract-version.outputs.version }}
- name: Deploy
uses: appleboy/ssh-action@v1.0.0
with:
host: ${{ secrets.MAIN_HOST }}
port: 4222
username: ${{ secrets.MAIN_USERNAME }}
password: ${{ secrets.MAIN_KEY }}
script: |
docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.MAIN_DOCKER_IMAGE }}:${{ needs.extract-version.outputs.version }}
docker stop ${{ secrets.MAIN_DOCKER_IMAGE }}
docker rm -f ${{ secrets.MAIN_DOCKER_IMAGE }}
docker run --name=${{ secrets.MAIN_DOCKER_IMAGE }} -d -p 3000:3000 ${{ secrets.DOCKER_USERNAME }}/${{ secrets.MAIN_DOCKER_IMAGE }}:${{ needs.extract-version.outputs.version }}
docker container prune -f
docker image prune -f
create-release:
needs: [CD, extract-version]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: create release
uses: ncipollo/release-action@v1.13.0
with:
tag: ${{ needs.extract-version.outputs.version }}
name: ${{ needs.extract-version.outputs.version }}
105 changes: 105 additions & 0 deletions .github/workflows/main_server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Main CI/CD

on:
pull_request:
branches: ['env/main_cicd']
types: ['closed']

permissions:
contents: read

jobs:
check-branch:
if: contains(github.head_ref, 'release')
runs-on: ubuntu-latest
steps:
- name: Check branch
run: |
echo "This is a release branch"
check-merged:
needs: check-branch
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Check merged
run: |
echo "This is a merged release branch"
extract-version:
needs: check-merged
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract-version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Extract version
id: extract-version
run: |
echo "Extract version: this version is $(echo "$(git show -s --format=%s)" | egrep -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')" >> "$GITHUB_OUTPUT"
CI:
name: Main Server CI Check
needs: extract-version
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16
- name: Check version
run: |
echo "This release version: ${{ needs.extract-version.outputs.version }}"
- name: Install Docker
run: docker compose up -d
- name: Change directory
run: cd ${{ secrets.WORK_DIRECTORY }} // 환경 변수화 필요
- name: Install dependencies
run: npm install ${{ secrets.WORK_DIRECTORY }}
- name: Prettier
run: npm run prettier
- name: Lint
run: npm run lint
- name: Build Test
run: npm run build

CD:
name: Main Server CD Check
needs: CI
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
token: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
run: |
touch ${{ secrets.WORK_DIRECTORY }}/.env.production
echo "${{ secrets.MAIN_ENV }}" >> /home/runner/work/Peer-Frontend/Peer-Frontend/.env.production
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
docker build -f Dockerfile -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.MAIN_DOCKER_IMAGE }} .
docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.MAIN_DOCKER_IMAGE }}
- name: Deploy
uses: appleboy/ssh-action@v1.0.0
with:
host: ${{ secrets.MAIN_HOST }}
port: 4222
username: ${{ secrets.MAIN_USERNAME }}
key: ${{ secrets.MAIN_KEY }}
script: |
docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.MAIN_DOCKER_IMAGE }}
docker rm -f ${{ secrets.MAIN_DOCKER_IMAGE }}
docker run -d -p 3000:3000 ${{ secrets.DOCKER_USERNAME }}/${{ secrets.MAIN_DOCKER_IMAGE }}
docker container prune -f
docker image prune -f
20 changes: 20 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { StorybookConfig } from '@storybook/nextjs'

const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-onboarding',
'@storybook/addon-interactions',
'@storybook/addon-mdx-gfm'
],
framework: {
name: '@storybook/nextjs',
options: {},
},
docs: {
autodocs: 'tag',
},
}
export default config
15 changes: 15 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { Preview } from '@storybook/react'

const preview: Preview = {
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
}

export default preview
20 changes: 17 additions & 3 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ const withPWA = require('@ducanh2912/next-pwa').default({
dest: 'public',
register: true,
skipWaiting: true,
disable: false,
// disable: prod ? false : true, 나중에 true로 바꿔야함
disable: prod ? false : true, // 나중에 true로 바꿔야함
// runtimeCaching,
})

const WorkboxPlugin = require('workbox-webpack-plugin')

const nextConfig = withPWA({
reactStrictMode: false,
compiler: {
Expand All @@ -27,6 +28,12 @@ const nextConfig = withPWA({
'kr1-api-object-storage.nhncloudservice.com',
],
},
// plugins: [
// new WorkboxPlugin.GenerateSW({
// clientsClaim: true,
// skipWaiting: true,
// }),
// ],
webpack(config) {
config.module.rules.push({
test: /\.svg$/i,
Expand All @@ -38,7 +45,14 @@ const nextConfig = withPWA({
},
})

// module.exports = nextConfig
const runtimeCaching = {
plugins: [
new WorkboxPlugin.GenerateSW({
clientsClaim: true,
skipWaiting: true,
}),
],
}

module.exports = nextConfig

Expand Down
Loading

0 comments on commit efca9b0

Please sign in to comment.