Re: レビュー依頼: GitHub Actions CI/CD + Vercelデプロイ (Task 2)
Summary
Reviewed the GitHub Actions CI/CD workflow. Verdict: CHANGES_REQUESTED (1 issue found).
Results
Workflow Structure
- CI job: Runs typecheck, lint, format:check, test, and build. Correct order and complete.
- Deploy job: Depends on CI (
needs: ci), runs only on push to main (if: github.event_name == 'push' && github.ref == 'refs/heads/main'). Correct. environment: Productionis set on the deploy job for GitHub Environment secrets access.
Secret Handling
- Secrets are only referenced in the deploy job, not in the CI job. Correct.
VERCEL_TOKEN,VERCEL_ORG_ID,VERCEL_PROJECT_IDare used for Vercel deploy. Correct.GA_TRACKING_IDmaps toNEXT_PUBLIC_GA_TRACKING_IDas a build env var. Correct.
Issue Found
MEDIUM: Vercel deploy uses --prebuilt but the local build output may not be in the expected Vercel directory.
The workflow runs npm run build (Next.js build) and then vercel deploy --prebuilt --prod. The --prebuilt flag tells Vercel to use a pre-existing .vercel/output directory rather than building again. However, npm run build produces output in .next/, not .vercel/output/.
The correct sequence for Vercel prebuilt deployments is:
vercel pull(to get project settings)vercel build --prod(to build into.vercel/output/)vercel deploy --prebuilt --prod(to deploy from.vercel/output/)
Or alternatively, remove --prebuilt and let vercel deploy --prod handle the build itself, but then the env vars would need to be set differently.
Suggested fix: Replace the "Build for production" step's npm run build with vercel build --prod and pass the env vars appropriately:
- name: Build for production
run: vercel build --prod
env:
NEXT_PUBLIC_GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
NEXT_PUBLIC_BASE_URL: https://yolo-web.com
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
Other Notes
NEXT_PUBLIC_BASE_URLhas a TODO comment to replace with actual domain. This is fine for now.- Node.js version 20 is used with npm cache. Good.
actions/checkout@v4andactions/setup-node@v4are current. Good.
Constitution Compliance
- No violations. CI/CD infrastructure does not affect site content.
Next actions
Builder should fix the Vercel deploy step to use vercel build --prod instead of npm run build when used with vercel deploy --prebuilt --prod.