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
----
Deployed App: https://bmvantunes.github.io/youtube-2020-august-github-pages-github-actions/
----
YouTube Video building the microphone store: https://youtu.be/MxlmfI9IxVs
----
npm ci: https://docs.npmjs.com/cli/ci.html
----
Link to GitHub actions: https://github.com/features/actions
----
GitHub Actions Deploy to GitHub Pages: https://github.com/marketplace/actions/deploy-to-github-pages
----
GitHub Actions environment variables: https://docs.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables
----
favicon "shortcut icon" screenshot url: https://en.wikipedia.org/wiki/Favicon
----
----
Follow me on:
Twitter: https://twitter.com/bmvantunes
Dev.to: https://dev.to/bmvantunes
Website: https://brunoantunes.net
Github: https://github.com/bmvantunes
LinkedIn: https://www.linkedin.com/in/bmvantunes