Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wich is the right publish-dir path to Nextjs? #832

Open
lucasggmc opened this issue Oct 5, 2022 · 5 comments
Open

Wich is the right publish-dir path to Nextjs? #832

lucasggmc opened this issue Oct 5, 2022 · 5 comments
Labels
question Further information is requested

Comments

@lucasggmc
Copy link

lucasggmc commented Oct 5, 2022

I'm trying to deploy my app on Netlify, There is no problem during the deploy, but I don't know the right publish-dir to can see my home page.

image

image

@nwtgck nwtgck added the question Further information is requested label Oct 6, 2022
@nwtgck
Copy link
Owner

nwtgck commented Oct 6, 2022

Could you show me the source?

@lucasggmc
Copy link
Author

That is my full .yml file

name: ci

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest

    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

    steps:
      - name: Checkout repository!
        uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: Setup Node
        uses: actions/setup-node@v1
        with:
          node-version: ^14.19.1

      - name: Install dependencies
        run: yarn --frozen-lockfile

      - name: Run Jest tests
        run: yarn test

      - name: Deploy to Netlify
        uses: nwtgck/actions-netlify@v1.2
        env:
          NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
          NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
        with:
          publish-dir: './public'
          production-branch: main
          production-deploy: true
        timeout-minutes: 2

@nwtgck
Copy link
Owner

nwtgck commented Oct 15, 2022

Thanks. The yaml doesn't seem to contain a build process. You need yarn build or something.

@dbk91
Copy link

dbk91 commented Nov 9, 2022

I think there are a few issues here.

  1. Usually the build directory is either .next/ if using next build or out if using next build && next export, so updating the publish-dir to one of those directories should get you closer to a solution.
  2. If you're planning on using a Next.js server runtime—which is the former of the build commands above—you'll need to have the Netlify + Next.js plugin

Having said that, I tried using this Github action to produce the Next.js runtime and it doesn't seem to be respecting it. Not sure if there is an option to include the build flag as a part of the process.

The equivalent command using Netlify Actions would be deploy --build.

@gcb
Copy link

gcb commented Nov 1, 2024

I see most projects use three dirs for nextjs, e.g. https://github.com/leerob/next-self-host/blob/main/Dockerfile#L20 [public, .next/standalone, .next/static]

Also, the build step from https://github.com/netlify-templates/next-platform-starter plus this action with publish-dir: '.next/' doesn't seem to work, and that is the "official" nextjs template from netlify. Still haven't built locally to understand why.

Run nwtgck/actions-netlify@v3.0
  with:
    publish-dir: .next/
    production-branch: master
    github-token: ***
    production-deploy: true
    deploy-message: Deployed from  Action. 
    enable-commit-comment: false
    enable-pull-request-comment: false
    overwrites-pull-request-comment: true
    enable-github-deployment: false
  env:
    NETLIFY_SITE_ID: ***
    NETLIFY_AUTH_TOKEN: ***
Error: No files or functions to deploy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants