Use the artifacts property to pass build artifacts from one build stage down to all the following stages.

.gitlab-cy.yml
stages:
- stage_1
- stage_2

one:
stage: stage_1
script:
- echo "File 1" >> ./file1.txt
- echo "File 2" >> ./file2.txt
- mkdir dir1
- echo "dir1 File" >> ./dir1/file.txt
- mkdir dir2
- echo "dir2 File" >> ./dir2/file.txt
artifacts:
paths:
- file1.txt
- dir1/

two:
stage: stage_2
script:
- ls
- ls dir1
- cat file1.txt
- cat dir1/file.txt

In the .gitlab-ci.yml above we are defining a build with 2 stages.

In stage_1 we are creating 4 files:

.
├── dir1
│   └── file.txt
├── dir2
│   └── file.txt
├── file1.txt
└── file2.txt

In stage_2, the following files files (created in stage_1) are available:

.
├── dir1
│   └── file.txt
├── file1.txt

The magic happens in the artifacts section of stage_1:

artifacts:
paths:
- file1.txt
- dir1/

which means pass file1.txt and the dir1 folder (+ it’s content) to all the following stages.