Gitlab-ci job not triggered with rule only on tags

Hello,
Is it currently possible to trigger a job on a pipeline that contains a rule, only: -tags ?
Because I of course tried to do it, and my job never launches after pushing a tag to the repository.
I use another job which launches the semantic-release plugin to create my tag.
Thank you in advance for your response.
Sincerely.

Hi @Luluxation :wave: Welcome to the GitLab Community Forum! :tada:

Use of only is technically deprecated.

For your use case (only trigger job in pipelines running on tags), I something like this should work:

job:
  script:
    - something
  rules:
    if: $CI_COMMIT_TAG
        when: always

@gitlab-greg
Hi Greg, unfortunately this rule is not working. I am having it on my main branch (protected one). Got a single job that has that rule but pushing a tag does nothing. It does not trigger pipeline.

It works when I used “only” but besides its deprecated, it also triggers pipeline twice.
Any advice here?