DEV Community

Cover image for Deploy Nextjs app to github-pages with Github Actions
Mentor Kadriu
Mentor Kadriu

Posted on

Deploy Nextjs app to github-pages with Github Actions

Github made super easy to deploy nextjs app to github pages using Github Actions.

First let's create a nextjs app: npx create-next-app@latest. Follow all the steps to setup a new nextjs app.
Then go to github.com and create a new repository. I named my nextjs-my-app, you can name it whatever you want. Follow the steps to push an existing repository from the command line.
Now go the repository settings:

  1. Go to Settings

Image description

  1. From left side navigation go to Pages

Image description

  1. On Build and deployment section for the source choose: Github Actions (beta)

Image description

  1. Nextjs config section will show up. Click on configure.

Image description

  1. Commit nextjs.yml auto generated file.

Image description

Image description

  1. In few seconds you will see that deployment is done.
  2. To see nextjs app live go to : https://[username].github.io/[repository-name]/ For me is: https://mentorkadriu.github.io/nextjs-my-app/

Top comments (1)

Collapse
 
vulcanwm profile image
Medea

This is really helpful! I will try it out with my next Next.js project!