Deploying an NX monorepo app to Github pages

I just learned about NX and decided to try it out with my website that was made in angular to try and break it down into libraries instead of copying my UI elements to various other project.

The problem I am faced with however is that I can’t seem to deploy from any folder except the ./docs folder on GitHub Pages. Is there a way around this constraint? Or is the only way to upload my build to a different repository and host it there. Keeping the monorepo separate from the actual front-end deployment?

Hi there! :wave: Welcome to the Community!

Unfortunately, at this time you can’t publish Pages from anywhere aside from the root directory or the /docs directory. Our engineers are working on allowing Pages to be deployed from any branch (coming soon! :crossed_fingers:), but selecting other directories isn’t going to be part of that change.

I think you’re correct that the way to do this would be to upload your build(s) to (a) different repo(s).

Does anybody else have other suggestions?

1 Like

I am currently hosting it with a separate repo, which might change when that feature gets implemented. For now though, this will do. Its a little more tedious to make a deployment to ghp, but its not that big of a deal. Custom solution for now is to copy the build files to another folder which is a repo for the build and deploy it from there using automated console commands.

When you say “working on” is there an expected timeframe? Or would I be best to assume that it’ll be there sometime in the future, but doesn’t have much priority?

The change to allow Pages to be published from any branch is tentatively scheduled to roll out by the end of the month (but as I mentioned, it won’t include selecting any directory – you’ll still be limited to /docs or the root directory).