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:
- Go to Settings
- From left side navigation go to Pages
- On Build and deployment section for the source choose: Github Actions (beta)
- Nextjs config section will show up. Click on configure.
- Commit
nextjs.yml
auto generated file.
- In few seconds you will see that deployment is done.
- 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)
This is really helpful! I will try it out with my next Next.js project!