Skip to content

Create nextjs.yml#5

Open
Dargon789 wants to merge 1 commit intomainfrom
Dargon789-patch-1
Open

Create nextjs.yml#5
Dargon789 wants to merge 1 commit intomainfrom
Dargon789-patch-1

Conversation

@Dargon789
Copy link
Copy Markdown
Owner

@Dargon789 Dargon789 commented Jan 7, 2026

deploy next.js site to pages

Please, go through these steps before you request a review:

📝 Describe your changes

🔎 Attach a source of truth or evidence that allows reviewers to confirm the changes independently

Summary by Sourcery

CI:

  • Introduce a Next.js GitHub Actions workflow that builds the app, caches dependencies, and deploys the generated static site to GitHub Pages on main branch pushes and manual runs.

deploy next.js site to pages

Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>
@gemini-code-assist
Copy link
Copy Markdown

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Jan 7, 2026

Reviewer's Guide

Adds a GitHub Actions workflow to build a Next.js project and deploy it to GitHub Pages on pushes to the main branch or manual dispatch, including package manager detection, build caching, and a separate deployment job.

Sequence diagram for Next.js build and deploy workflow execution

sequenceDiagram
  actor Developer
  participant GitHub_Repository
  participant GitHub_Actions
  participant Build_Job
  participant Deploy_Job
  participant GitHub_Pages

  Developer->>GitHub_Repository: Push to main or trigger workflow_dispatch
  GitHub_Repository->>GitHub_Actions: Trigger workflow nextjs.yml

  GitHub_Actions->>Build_Job: Start build job
  Build_Job->>Build_Job: Checkout repository
  Build_Job->>Build_Job: Detect package manager (yarn or npm)
  Build_Job->>Build_Job: Setup Node 20 with dependency cache
  Build_Job->>Build_Job: Configure Pages for Next.js static_site_generator
  Build_Job->>Build_Job: Restore .next cache
  Build_Job->>Build_Job: Install dependencies
  Build_Job->>Build_Job: Run next build
  Build_Job->>GitHub_Actions: Upload Pages artifact from ./out

  GitHub_Actions->>Deploy_Job: Start deploy job (needs build)
  Deploy_Job->>GitHub_Pages: Deploy artifact using actions/deploy-pages
  GitHub_Pages-->>Deploy_Job: Return page_url
  Deploy_Job-->>GitHub_Actions: Set environment url output
Loading

File-Level Changes

Change Details Files
Introduce CI/CD workflow to build and deploy the Next.js site to GitHub Pages.
  • Create a GitHub Actions workflow triggered on pushes to the main branch and manual workflow_dispatch events.
  • Configure required GitHub Pages permissions and concurrency settings for safe, single-flight deployments.
  • Add a build job that checks out the repository, detects the Node.js package manager, sets up Node 20 with caching, configures GitHub Pages for a Next.js static site, restores the Next.js build cache, installs dependencies, runs the Next.js build, and uploads the build output as a Pages artifact from the ./out directory.
  • Add a deploy job that depends on the build job and publishes the uploaded artifact to GitHub Pages using the actions/deploy-pages action, exposing the deployed page URL via the deployment step outputs.
.github/workflows/nextjs.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The workflow always assumes Yarn or npm based solely on yarn.lock/package.json; if you might use pnpm or another manager later, consider extending Detect package manager to detect those lockfiles explicitly to avoid misconfigured installs.
  • The artifact upload path is hard-coded to ./out, which only exists for static export setups; consider aligning this with the actual Next.js build output (e.g., respecting output: 'export' or .next), or making it configurable to avoid silent deployment issues if the build directory changes.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The workflow always assumes Yarn or npm based solely on `yarn.lock`/`package.json`; if you might use pnpm or another manager later, consider extending `Detect package manager` to detect those lockfiles explicitly to avoid misconfigured installs.
- The artifact upload path is hard-coded to `./out`, which only exists for static export setups; consider aligning this with the actual Next.js build output (e.g., respecting `output: 'export'` or `.next`), or making it configurable to avoid silent deployment issues if the build directory changes.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant