[This is a duplicate of https://stackoverflow.com/questions/63281252/with-gitlab-pages-and-ci-cd-how-do-you-build-different-branches-to-different-s, where I’ll also post the solution if one exists/materializes ]
I am writing a number of R BookDown books. These are suitable as living books, that can be updated more or less continuously. However, we now want to use one in teaching. Therefore, we want to build an environment where we have a production version (the
prod branch) hosted at GitLab pages with, for example, the default branch, called
dev, and maybe a
staging branch rendered into subdirectories (e.g.
There are apparently several approaches, but I haven’t managed to get any to work.
- One is to use Review Apps (this seems promising), but these seem to require Kubernetes (see here; I’m not entirely sure what that is; and certainly don’t need it for anything else, it seems?).
- Another is to build Merge Trains. However, GitLab adamantly keeps insisting that (like here - expect that including the proposed solution didn’t work in my case).
- I also tried checking out different branches and then building into the right directory, using the suggestion here. However, git complains that “
dev did not match any file(s) known to git”.
I am probably (well, quite clearly) way out of my depth here. But it feels like this (i.e. building different branches in sub-directories of Pages’
public directory) should be doable even for people who don’t code for a living…
My current CI configuration is here, and the GitLab Runner complaint about the file it doesn’t know is here. - but I’m not sure that’s useful to look at. There seem to be so many different approaches (and I kept lots of fragments there, commented out, in case I’d need them again).
Is there a generic GitLab pages CI configuration that builds one branch into
public and other branches into subdirectories?