Simple pipeline to make a zip with some repo files and add it to releases

Hello, I just want to make a simple CD/CI pipeline that does the following:

  • Each time a new commit is done to the main branch, a zip is generated with some files from the repo (not all files)
  • A new release is created (tag) with the version given in the commit (for example if the commit has v0.99 that will be the new release created)

So far I’ve come up to this gitlab-ci.yml file

image: "ubuntu"

variables:
  EXPORT_NAME: ProjectName

build:
  script:
    - mkdir ./datafiles
    - cp ./contents/* ./datafiles
  artifacts:
    name: $EXPORT_NAME$CI_COMMIT_TAG
    paths:
      - ./contents
  only:
      - main

My problem right now is that the generated artifact name does not contain the version (it is named ProjectName.zip only) and i also dont know how to generate a new release and include the generated artifact.

I’m a newbie in all of this Gitlab CD/CI stuff, can somebody lend me a hand?