Closed MyKo101 closed 4 years ago
Ah yes. This action deletes all the files in the target branch and replaces them with the contents of the folder you have chosen.
That's a problem because it will delete the CNAME
file at the root of your master branch, which is automatically created by GitHub when you configure a custom domain.
There's no way to exclude files to delete with this action atm, so I would recommend also adding the CNAME
file to the directory you're publishing before running your action. It's simply going to be a text file with your custom domain as its contents. You can look at the history of your master
branch to see it.
Also, very pleased to hear you focused your first blog post on this! That makes me very happy, I'll give it a read now!
Thanks! That solved it.
echo -n "michaelbarrowman.co.uk" > public/CNAME
Just tried it out and it works, also added it at the bottom of the blogpost (and also fixed the Social Sharing links on there!)
And fortunately, the way that I'm building my website, this file doesn't get deleted when I rebuild (annoying in other ways sometimes).
I have recently switched to using
main
as my default branch on my User repo, however I know that GitHub Pages can only be built from themaster
branch. I'm using this action to automatically push mypublic
subdirectory (i.e. the one with the website in) to themaster
branch. The theory being that I cangit push
my entire repo tomain
and it'll update my site to be just the subdirectory. Similar to an example on your homepage, except this is for a User repo, rather than a normal repo. However, whenever this update happens, my Custom Domain in my settings gets reset to nothing.I think this might be because your Action destroys the
master
branch and then re-builds it, which might be why it's getting reset, although I'm not sure how your code works under-the-hood to be sure that this is what's happening.If so, would a fix be possible/easy? Or would you be able to demonstrate how the push to
master
could happen without destroying the branch?(PS. Love the Action, just started my website/blog using it and even focused my first blog post on it)