From f5e411f1815b76323b7f782d4ea0cbe9c4be0d46 Mon Sep 17 00:00:00 2001 From: Gwangseo Go Date: Sat, 11 Feb 2023 04:36:15 +0900 Subject: [PATCH] fix: migrate db on build & add lint action (#24) * fix: remove migration actions & migrate on build * build(github): add lint action * fix: fix typo --- .github/pull_request_template.md | 3 ++- .github/workflows/db-migration-prod.yml | 28 ------------------------- .github/workflows/db-migration.yml | 27 ------------------------ .github/workflows/lint.yml | 22 +++++++++++++++++++ package.json | 2 +- 5 files changed, 25 insertions(+), 57 deletions(-) delete mode 100644 .github/workflows/db-migration-prod.yml delete mode 100644 .github/workflows/db-migration.yml create mode 100644 .github/workflows/lint.yml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index dfe204d..e3a8df3 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -11,5 +11,6 @@ Resolves #(이슈 번호) - [ ] GitHub Projects에 연결 - [ ] 작업한 사람 모두를 Assign - [ ] Code Review 요청 -- [ ] DB Schema를 바꾼 경우, DB Schema를 바꾸는 다른 PR이 없는지 확인 +- [ ] 올라온 PR 중 DB Schema를 바꾸는 PR이 없는지 확인 +- [ ] DB Schema를 바꾼 경우, 다른 PR이 없는지 확인 - [ ] `main` 브랜치의 최신 상태를 반영하고 있는지 확인 diff --git a/.github/workflows/db-migration-prod.yml b/.github/workflows/db-migration-prod.yml deleted file mode 100644 index dec33e1..0000000 --- a/.github/workflows/db-migration-prod.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: 'DB Migration (Production)' -on: - push: - branches: - - main - paths: - - 'src/database/schema.prisma' - -jobs: - migrate: - runs-on: ubuntu-latest - environment: Production - steps: - - uses: actions/checkout@v3 - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 16 - cache: yarn - - - name: Install dependencies - run: yarn install --frozen-lockfile - - - name: Migrate - run: yarn db:prod - env: - DATABASE_URL: ${{ secrets.DATABASE_URL }} diff --git a/.github/workflows/db-migration.yml b/.github/workflows/db-migration.yml deleted file mode 100644 index 93f1597..0000000 --- a/.github/workflows/db-migration.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: 'DB Migration' -on: - pull_request: - types: [opened, synchronize] - paths: - - 'src/database/schema.prisma' - -jobs: - migrate: - runs-on: ubuntu-latest - environment: Preview - steps: - - uses: actions/checkout@v3 - - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 16 - cache: yarn - - - name: Install dependencies - run: yarn install --frozen-lockfile - - - name: Migrate - run: yarn db:prod - env: - DATABASE_URL: ${{ secrets.DATABASE_URL }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..3a3c497 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,22 @@ +name: 'Lint' +on: pull_request + +jobs: + lint: + runs-on: ubuntu-latest + environment: Preview + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 16 + cache: yarn + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Lint + run: yarn lint diff --git a/package.json b/package.json index 2de9161..697af25 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "dev": "next dev", - "build": "next build", + "build": "npx prisma migrate deploy && next build", "start": "next start", "lint": "next lint", "storybook": "start-storybook -p 6006",