File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Update Docs Revision And Database
2+ on :
3+ push :
4+ branches : [ "main" ]
5+ permissions :
6+ contents : write
7+ jobs :
8+ check-docs :
9+ runs-on : ubuntu-latest
10+ strategy :
11+ matrix :
12+ node-version : [22.x]
13+ steps :
14+ - uses : actions/checkout@v4
15+ - uses : actions/setup-node@v4
16+ with :
17+ node-version : ${{ matrix.node-version }}
18+ cache : ' npm'
19+ - run : npm ci
20+ - run : npx drizzle-kit migrate
21+ env :
22+ DATABASE_URL : ${{ secrets.DATABASE_URL }}
23+ - run : npx tsx ./scripts/checkDocs.ts --write
24+ env :
25+ DATABASE_URL : ${{ secrets.DATABASE_URL }}
26+ - name : Configure git for push
27+ run : |
28+ git remote set-url origin "https://github-actions:${GITHUB_TOKEN}@github.com/${{ github.repository }}"
29+ git config user.name "github-actions[bot]"
30+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
31+ env :
32+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
33+ - name : Commit build output
34+ run : |
35+ git add .
36+ git diff --staged --exit-code || (git commit -m "[ci] update revisions.yml" && git push origin main)
37+ # The `||` ensures the commit and push only happen if there are changes (git diff exits with non-zero)
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ npm run lint
5757### データベースのスキーマ
5858
5959* データベースのスキーマ(./app/schema/hoge.ts)を編集した場合、 ` npx drizzle-kit generate ` でmigrationファイルを作成し、 ` npx drizzle-kit migrate ` でデータベースに反映します。
60- * また、mainにマージする際に本番環境のデータベースにもmigrateをする必要があります
60+ * 本番環境のデータベースのmigrateはmainにpushされた際にGitHub Actionで実行されます
6161* スキーマのファイルを追加した場合は app/lib/drizzle.ts でimportを追加する必要があります(たぶん)
6262* ` npx prisma dev ` で立ち上げたデータベースは ` npx prisma dev ls ` でデータベース名の確認・ ` npx prisma dev rm default ` で削除ができるらしい
6363
You can’t perform that action at this time.
0 commit comments