Skip to content

Deploy script removes github pages custom domain #654

Closed

Description

@sylvainbannier

When using these to deploy to github :

git commit -am "Save local changes"
git checkout -B gh-pages
git add -f build
git commit -am "Rebuild website"
git filter-branch -f --prune-empty --subdirectory-filter build
git push -f origin gh-pages
git checkout -

Github loses the custom domain setting

Note : I think it's due to the -B option in git checkout -B gh-pages.

Activity

  1. fson commented on Sep 16, 2016

    @fson
    Contributor

    We're likely going to change the GitHub deployment instructions to use the simpler docs folder in master branch approach (#520).

    The new set of commands to deploy will be basically:

    npm run build
    mv build docs
    git add docs
    git commit -m "Rebuild website"
    git push origin master
    

    I think this issue will be fixed by that change?

  2. added this to the 1.0.0 milestone on Sep 18, 2016
  3. sylvainbannier commented on Sep 19, 2016

    @sylvainbannier
    Author

    @fson it think so. thanks.

  4. Janpot commented on Oct 3, 2016

    @Janpot
    Contributor

    gh-pages in combination with following script seems to work pretty well for me:

    "deploy": "npm run build && gh-pages -d build"
    

    this pushes the build folder to the gh-pages branch. Basically turning that set of comands into a one liner.

    Edit:

    Just saw the discussion under #520. gh-pages could be the solution they were looking for.

  5. fson commented on Oct 3, 2016

    @fson
    Contributor

    gh-pages looks like what we want indeed, so we just need to document the command in Create React App and test that it works. @Janpot would you be interested in making a pull request?

  6. Janpot commented on Oct 4, 2016

    @Janpot
    Contributor

    @fson done in #841

  7. fson commented on Oct 4, 2016

    @fson
    Contributor

    Also gh-pages will overwrite the CNAME file, because it just always pushes everything from the build folder to the gh-pages branch.

    A simple workaround for this problem is to add a CNAME file with the custom domain inside the public folder in your project and it will be copied to the build and deployed.

  8. dsernst commented on Oct 25, 2016

    @dsernst
    Contributor

    I believe this is no longer an issue. I thought I was coming across it, but the problem was that I had not re-run npm run build since adding the CNAME file to public/.

    Using @Janpot's recommended deploy script:

    "deploy": "npm run build && gh-pages -d build"
    

    rather than the readme's recommendation

    "deploy": "gh-pages -d build"
    

    would have saved me 20 minutes of debugging the problem.

    ¯\_(ツ)_/¯

  9. Janpot commented on Oct 25, 2016

    @Janpot
    Contributor

    @dsernst yeah, not sure why I didn't put my original script. And in retrospect I regret my decision.

  10. modified the milestones: 0.8.0, 1.0.0 on Nov 23, 2016
  11. added a commit that references this issue on Sep 20, 2017
  12. added a commit that references this issue on May 17, 2018
  13. locked and limited conversation to collaborators on Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions