Export secret file to Gitlab pipeline

First, export file with base64 encoding

Use this command to convert file to base64 and copy result to clipboard

cat myfile.txt | base64

Second, add Environment variable to Gitlab

Copy result and insert it to Gitlab pipeline settings (On project site / Settings / Pipelines)

Add secret variable with file encypted to base64

Third, create file in pipeline

In .gitlab-ci.yml file add command to create file from environment variable

echo $MYFILE | base64 -d > /any/path/myfile.txt

The result file is absolutely same as first one in your computer, you can check it with command sha1sum.