Most external CI workflows "deploy" to GitHub Pages by committing the build output to the gh-pages branch of the repository, and typically include a. Your GitHub Pages site will always be deployed with a GitHub Actions workflow run, even if you've configured your GitHub Pages site to be built using a different CI tool. For more information, see " Troubleshooting Jekyll build errors for GitHub Pages sites." If you choose the docs folder on any branch as your publishing source, then later remove the /docs folder from that branch in your repository, your site won't build and you'll get a page build error message for a missing /docs folder. If you are publishing from a branch and your site has not published automatically, make sure someone with admin permissions and a verified email address has pushed to the publishing source.Ĭommits pushed by a GitHub Actions workflow that uses the GITHUB_TOKEN do not trigger a GitHub Pages build. GitHub provides starter workflows for common publishing scenarios to help you write your workflow. If you want to use a build process other than Jekyll or you do not want a dedicated branch to hold your compiled static files, we recommend that you write a GitHub Actions workflow to publish your site. Whenever changes are pushed to the source branch, the changes in the source folder will be published to your GitHub Pages site. The source branch can be any branch in your repository, and the source folder can either be the root of the repository ( /) on the source branch or a /docs folder on the source branch. You can specify which branch and folder to use as your publishing source. If you do not need any control over the build process for your site, we recommend that you publish your site when changes are pushed to a specific branch. To give our app a friendly nudge in the right direction, we need to make an edit to our package.json file in our project’s root directory.You can publish your site when changes are pushed to a specific branch, or you can write a GitHub Actions workflow to publish your site. The problem here is that our app is looking for its resources (files) in the wrong location. However, if you navigate to the Pages URL for your repository you may be presented with a blank screen and some 404s in the console. To be precise, it points GitHub Pages at the /build directory. Unfortunately, the solution above only gets us so far. That takes care of that problem… Problem 2 gitignore file and then run the following (solution found here): git subtree push -prefix build origin gh-pages To do that, first uncomment the directory in your. The SolutionĪssuming you’ve already run npm run build, you’ll want to push only your /build directory to a specific gh-pages branch on GitHub. It was going to be down to the third option. So that helped me identify the problem I wanted to serve from my /build directory so the first two options weren’t going to work. This post cleared up the fact that Pages only recognises the following options to serve your site from: The first issue was the fact that you can’t point Pages to serve from a subdirectory (like /build) in your master branch, other than /docs. Being new to GitHub Pages, I experienced a couple of issues in the process of getting a Create React App project live.
0 Comments
Leave a Reply. |