In this video, we are going to deploy a Next.js (SSG) application to GitHub Pages using GitHub Actions (CI/CD).

Make sure you can run “npm run build && npm run export” in your application. Only Static sites/applications can be deployed to GitHub Pages. If you need a server running (because you use getInitialProps, getServerSideProps or fallback:true) you may consider other options like Vercel, Azure, AWS, etc…

During the video, we will see how to use environment variables in GitHub actions as well.


Timeline:

  • 00:00 Introduction
  • 01:25 GitHub Actions first steps
  • 06:21 First GitHub Actions job completed
  • 06:54 Setup GitHub Pages in repository settings
  • 08:10 See the results of the first deployment
  • 08:57 Next.js assetPrefix explanation
  • 09:52 Next.js basePath explanation
  • 10:38 Implement assetPrefix and basePath in next.config.js
  • 11:34 Fix images URL
  • 12:59 Second GitHub Actions job completed
  • 13:45 Disable jekyll from running on GitHub Pages deployments with .nojekyll file
  • 15:40 Third GitHub Actions job completed
  • 15:52 Fix images url location with prefix
  • 17:48 Fix favicon location
  • 18:04 Setup environment variables
  • 21:55 Change GitHub Actions command names
  • 23:18 Conclusions and questions to you :)

Repository: https://github.com/bmvantunes/youtube-2020-august-github-pages-github-actions

#next #github #programming #developer

(CI/CD): Deploy Next.js (SSG) to GitHub Pages using GitHub Actions
9.70 GEEK