3

I have a react app deployed with git hub pages, using gh-pages plugin. My package.json entry look like this.

"scripts": {
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build”,
     .....
   }

Eveything worked fine until I tried to use a custom domain.

  1. I configured the required A and CNAME entry in my domain provider DNS settings.

  2. I created the CNAME file in the develop branch. That is the branch that I have checked out on my local machine.

  3. I run npm run deploy on develop branch on local machine.

  4. plugin pushed the build code to gh-pages branch on remote.

  5. the gh-pages branch on remote does not contain the CNAME file.

  6. after every deploy I have to manually add the custom-domain from github settings pages section, which eventually create a CNAME file. And then every works.

Is there a configuration requied in package.json to force gh-pages plugin to copy the CNAME file ?

ThrowableException
  • 1,168
  • 1
  • 8
  • 29
  • 2
    `gh-pages` won't do that, it's up to _you_ to get `build/` in a deployable state. Maybe add a `postbuild` script that copies the file across (or use `echo` in the `deploy` script as shown [_in the docs_](https://www.npmjs.com/package/gh-pages)). – jonrsharpe Jun 19 '22 at 19:55
  • Thanks @jonrsharpe updating the deployment line did he trick. – ThrowableException Jun 19 '22 at 20:26

0 Answers0