メインコンテンツまでスキップ

CI / CD

  • 作成:
  • 更新:
  • 著者:
    Takeshi Takatsudo

CI/CD configuration running on GitHub Actions. Workflow files are in .github/workflows/.

Workflows

FileTriggerPipeline
main-deploy.ymlPush to mainBuild → E2E tests → Production deploy
pr-checks.ymlPR targeting mainBuild → Preview deploy

main-deploy.yml: Production Deploy

Runs on every push to the main branch.

Job Flow

  1. Build — Build the Next.js blog (pnpm build) and Docusaurus doc site (pnpm doc:build)
  2. E2E Tests — Run Playwright smoke tests against the blog build output
  3. Deploy — Combine both outputs and deploy to Netlify as production (only if both build and tests pass)

Concurrency

Only one run at a time. If an earlier deploy is in progress, the later run waits (does not cancel the earlier one).

pr-checks.yml: PR Checks

Runs on every PR created or updated against the main branch.

Job Flow

  1. Build — Build the Next.js blog (pnpm build) and Docusaurus doc site (pnpm doc:build)
  2. Preview Deploy — Combine both outputs, deploy a preview to Netlify, and post the preview URL as a PR comment

Concurrency

In-progress runs for the same PR are cancelled when a new run starts (to save resources).

Deploy Target

Deployed to Netlify.

EnvironmentTriggerDeploy Type
ProductionPush to mainnetlify deploy --prod
PreviewPR create/updatenetlify deploy (draft)

Preview deploy URLs are automatically posted as a comment on the PR.

Build Scope

Both the blog and doc site are built in CI.

PackageBuild CommandOutput DirectoryServed At
Blog (blog/)pnpm buildblog/out//pj/zpaper/
Doc (doc/)pnpm doc:builddoc/build//pj/zpaper/doc/

The deploy step combines both outputs into a single directory structure matching the URL paths, then uploads it to Netlify.

Deploy Directory Structure

The combined output deployed to Netlify looks like this:

deploy/
pj/
zpaper/ ← Blog (Next.js static export)
articles/
tags/
...
doc/ ← Doc site (Docusaurus build)
docs/
...

Netlify Configuration

Build is handled by GitHub Actions, not Netlify. A netlify.toml at the repo root overrides Netlify's UI settings to skip the build step.

Secrets

Secrets used by GitHub Actions. Configured in the GitHub repository under Settings → Secrets.

SecretPurpose
NETLIFY_AUTH_TOKENAuthentication token for Netlify CLI
NETLIFY_SITE_IDTarget Netlify site ID