Search code examples
gitlabgitlab-cigitlab-pages

Gitlab pages - Incremental deploy


In gitlab pages, public directory content seems to be cleaned at each deployment. In some cases, I would keep existing files and add another ones. Do you know if it is possible to incremental deploy pages with gitlab ci?


Solution

  • The public folder is not cleaned during each deployment.
    However, most repositories do not actually have a public folder, it is instead created only dynamically during CI/CD. These dynamically created contents are not kept between deployments.

    Simply store all files you want to keep between deployments in your repository. This can be in a folder called public in the root of your repository. This way, you will not have to move the files during CI/CD. Just make sure you do not overwrite/move/delete the files during within your .gitlab-ci.yml configuration.

    Of course, you can also store the files anywhere else in your repository and just move them to the right location under public/ within your .gitlab-ci.yml configuration.