A template for clients should use the Github Pages, React and SSR using NextJS.
Read in other languages: English, Português Brasileiro
See this article.
This project has a simple deploy system to github pages.
npm run deploy
By default, we use the master
branch to store the source code and the gh-pages
branch to the compiled files for page.
The main script execute the others deploy scripts which do a specify step into deploy. Follow the scripts:
deploy:export
generates the build files and export from NextJS scripts (build and export).deploy:setup
add files for gh-pages or any others, like.nojekyll
orCNAME
.deploy:commit
creates a commit with the new deploy files, in other words, create a commit with theout
folder generated bynpm run deploy:export
.deploy:stage
creates a stage branch with the commit created previously and start a subtree with him.deploy:push
makes a push forced to the github page branch (gh-pages).
When we're creating our personal page (for example, mhsalves.github.io) the github force us to use as branch page the master
branch. So we need to use the master
branch for the compiled files.
In this case, we still use this deploy method, but we need update some things. First we need create a new source branch to your project, for example, my-source
(you can use any name, but I advice to use a name which make sense like source/master
, main
and etc).
Second, configure the project into Settings to make the my-source
branch be the default branch.
Third, update the script deploy:push
in package.json
file setting the gh-pages
to master
.
In the end, your source branch will be my-source
so all pull request will be to him and every time you execute the deploy script all compiled files will be pushed into master
branch.
Any problems, create an issue.