Question
I have a GitLab repo XXX/website-www
which contains code to generate a static website.
I am using GitLab CI for continuous integration/deployment.
For now, I have decided to use GitLab pages to host my static website. This could easily change in the future.
I found this simple configuration that I can add to my .gitlab-ci.yml
file:
pages:
stage: deploy
script:
- <...>
artifacts:
paths:
- <static_website_directory>
only:
- master
This works nicely, but has one issue. The GitLab pages url is now XXX.gitlab.io/website-www
.
I need to be able to access this website from a custom domain, and from what I know, this can't be done with the above URL.
I need to have something like XXX-website-www.gitlab.io
.
Possible solutions
1) One way to obtain the url I need is by creating a a group named XXX-website-www
, and inside, a repo named XXX-website-www.gitlab.io
.
This has a couple of problems:
2) Another solution would be to do repo mirroring. I would mirror XXX-website-www/XXX-website-www.gitlab.io
from XXX/website-www
, but I'm not even sure if you can mirror from another gitlab repo.
This sadly has another problem: the continuous integration will fail on the XXX/website-www
repo.
How else can I achieve this?
3) Another solution would be to create a separate XXX-website-www/XXX-website-www.gitlab.io
repo alongside XXX/website-www
.
I would change the continuous integration for XXX/website-www
to do a direct git add/commit/push to XXX-website-www/XXX-website-www.gitlab.io
.
I would then do an initial commit to XXX-website-www/XXX-website.www.gitlab.io
with GitLab pages CI.
This is quite a hassel, and still has the problem of number 1 above. It also seems messy working with git inside CI.
Another solution would be to create a separate XXX-website-www/XXX-website-www.gitlab.io repo alongside XXX/website-www.
I would change the continuous integration for
XXX/website-www
to do a direct git add/commit/push toXXX-website-www/XXX-website-www.gitlab.io
.
Well... you could reference XXX-website-www/XXX-website-www.gitlab.io
as a submodule (displayed as a subfolder) in XXX/website
.
Everything could be done, in the CI steps, within XXX/website
which would checkout XXX-website-www/XXX-website-www.gitlab.io
in its associated subfolder.
Add/commit/push can be done in that subfolder, provided a similar add/commit and push is done in its parent repo XXX/website