you’ll need to find a way to persist the old content. One way of exposure is with using the
artifacts setting making it available in the GitLab CI/CD web interface and going on from there.
I would toy with the idea of uploading the created file from the job into the Git repository with a new name, for example
report-$(date +%s) or similar - https://docs.gitlab.com/ee/api/repository_files.html#create-new-file-in-repository The step can be added to the
script and involve a curl call then, re-using the CI access token from the pre-defined environment variables.
One thing to be aware of - if you upload and commit this to git master, the CI will trigger again and possibly result in an endless loop. In order to prevent this scenario from happening, define a rule to only run the deployment when being tagged.
We use that for our blog at https://gitlab.com/everyonecancontribute/everyonecancontribute.gitlab.io/-/blob/1c712cc8/.gitlab-ci.yml#L15
- if: '$CI_COMMIT_TAG != null'