How to push a maven project site to GitLab pages from GitLab CI/CD

I have a Maven based project. As part of the build in .gitlab-ci.yml, I have mvn site that generates the Maven site for my project into the target/site subdirectory.
Now, I would like to host that project site on GitLab pages, in other words copy the whole site tree to a site in GitLab Pages.
I am at a loss on how to achieve this. The documentation, templates, and examples I could find, all assume that the main purpose of the project is the site.
I have found that GitHub has the Github-Site-Plugin. Does GitLab have something similar? Or can the above be tweaked for use on GitLab? If so, how?

1 Like

I am just looking into this exact thing now. Have you found any useful online resources?

I believe that the GitHub site plugin that I mention can be configured to do the job, combined with what you can find in the GitLab pages documentation about CI/CD. However, I have not had the time to work out the details.