Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 26 additions & 9 deletions .github/workflows/nextjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
name: Deploy Next.js site to Pages

on:
# Runs on pushes targeting the default branch
# Runs on pushes targeting the default branch, and dev branches
push:
branches: ["main"]
branches: ["main", "dev/**"] # dev/* のブランチにも反応するように変更

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -25,7 +25,7 @@ concurrency:
cancel-in-progress: false

jobs:
# Build job
# Build/Lint job
build:
runs-on: ubuntu-latest
steps:
Expand All @@ -39,20 +39,23 @@ jobs:
echo "manager=bun" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=bun" >> $GITHUB_OUTPUT

- name: Setup Bun
# Bunをインストールするための専用アクション
uses: oven-sh/setup-bun@v1
with:
bun-version: latest # または '1.1.0' のような特定のバージョンを指定

# mainブランチでのみPagesの設定とNext.jsの設定を適用
- name: Setup Pages
if: github.ref == 'refs/heads/main'
uses: actions/configure-pages@v5
with:
# Automatically inject basePath in your Next.js configuration file and disable
# server side image optimization.
static_site_generator: next

# キャッシュの復元(main/devのいずれでも依存関係のインストール前に実行)
- name: Restore cache
uses: actions/cache@v4
with:
Expand All @@ -67,18 +70,32 @@ jobs:
- name: Install dependencies
# 'bun install' を実行
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}

- name: Build with Next.js

# === 処理分岐 ===

- name: Run lint for dev branches
# ブランチ名が 'dev/' で始まる場合にのみ実行
if: startsWith(github.ref, 'refs/heads/dev/')
# lintコマンドを実行
run: ${{ steps.detect-package-manager.outputs.runner }} run lint

- name: Build with Next.js (for main branch)
# mainブランチの場合にのみ実行
if: github.ref == 'refs/heads/main'
# 'bun next build' を実行
run: ${{ steps.detect-package-manager.outputs.runner }} next build

- name: Upload artifact

- name: Upload artifact (for main branch)
# mainブランチの場合にのみ実行
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v3
with:
path: ./out

# Deployment job
deploy:
# mainブランチの場合にのみ実行
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand All @@ -87,4 +104,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v4
50 changes: 50 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"formatter": {
"enabled": true,
"formatWithErrors": false,
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 100,
"attributePosition": "auto"
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"jsxQuoteStyle": "double",
"quoteProperties": "asNeeded",
"trailingCommas": "es5",
"semicolons": "always",
"arrowParentheses": "asNeeded",
"bracketSpacing": true,
"bracketSameLine": false
}
},
"files": {
"ignore": [
"node_modules",
".next",
".git",
"dist",
"build",
"out",
"coverage",
"*.log",
".env*",
".DS_Store",
".vscode",
"*.md",
"eslint.config.js"
]
}
}
Loading