I'm trying to use the CI/CD of gitlab to compile a c++ project and create a release but, I'm struggling to understand how to get my binaries as assets on the release page. I manage to get an asset pointing to an artifact but all my releases will point to the last binary. Does anyone know what is the proper way to do this ? Here is my pipeline script:
build:
tags:
- docker_runner
stage: build
only:
- main
script:
- mkdir release
- apt update && apt install tree cmake ninja-build g++ -y
- cmake --preset default
- cmake --build --preset default
- cp cmake-build-default/hello_world release/hello_world
- tree
artifacts:
paths:
- release/hello_world
release:
image: registry.gitlab.com/gitlab-org/release-cli:latest
only:
- main
tags:
- docker_runner
stage: release
script:
- apt update && apt install tree -y
- tree
release:
tag_name: v0.3.3
description: v3.3
assets:
links:
- name: 'hello_world'
url: https://........./-/jobs/artifacts/main/browse?job=build
artifacts:
paths:
- release/hello_world
thanks
I tried to search on the docs but I can't find the place that explains this clearly
Directly attaching job artifacts links to a release is not recommended, because job artifacts are ephemeral and are used to pass data in the same pipeline. This means there’s a risk that they could either expire or someone might manually delete them.
Recommended approach is to use GitLab Packages Registry and pubish your binaries to this registry as a generic package
Here is an example from Gitlab documentation