Publish artifacts in source code?

I have a repo with a “public” folder and a “” script which when it runs will create a file in the public folder.

I configured .gitlab-ci.yml such that each run will be executed in a docker container and publish “public” folder as artifacts .gitlab-ci.yml · master · vvss-temp-user132 / test · GitLab

What would be an easy and secure way to push to master branch the file that generates?