Artifacts are not uploaded

I have a template yml file(.common-template-ci.yml) which contains all the steps in a generic way, the .common-template-ci.yml in imported/include in the .gitlab-ci.yml. The idea of this setup is because we have different applications but they all have the CI/CD steps in common.
In the .common-template-ci.yml, I have defined the artifacts section to upload the artifacts.
In the .gitlab-ci.yml, I have the include : .common-template-ci.yml

Gitlab: Self managed and Version: 13.11.4-ee
Runner version: 13.10.0

What is expected?
I expect the artifacts are saved/uploaded.

What is seen?
The artifacts section is completely ignored.

Steps to reproduce :
1.) Create .common-template-ci.yml

stages:
 - upload_artifacts

.upload_artifacts:
  stage: upload_artifacts
  script:
      - echo "This is an artifact" >> artifact.txt
  artifacts:
    paths:
       - artifact.txt
 allow_failure: false

2.) Create .gitlab-ci.yml

include: .common-template-ci.yml
stages:
 - upload_artifacts

upload_artifacts:
  stage: upload_artifacts
  script:
    - !reference [.upload_artifacts, script]
  tags:
    - artifact-runner

As seen below, the artifacts section is completely ignored.

Any pointer will be highly appreciated.

Summary

This text will be hidden

Huhhh. I figured it myself. Because the .upload_artifacts in the .common-template-ci.yml file is a hidden job, the artifacts node in the hidden artifacts has no effect.
By adding the artifacts: !reference [.upload_artifacts, artifacts] in the .gitlab-ci.yml file, the artifacts are now saved.

Complete .gitlab-ci.yml file -

include:  .common-template-ci.yml
stages:
    - upload_artifacts

upload_artifacts:
    stage: upload_artifacts
    script:
        - !reference [.upload_artifacts, script]
    allow_failure: false
    artifacts: !reference [.upload_artifacts, artifacts]

All good now.