publish-on:tag also publishes when no tag is set (helm-publish)

Describe the bug

When publish-on: tag is set, the helm-publish step is always executed (also in MR pipelines)

Expected behavior

The helm-publish step is only executed when the pipeline is started by a tag.

Actual behavior

The helm-publish step is always executed

Logs and/or screenshots

You can see in the screenshot that the helm-publish step is executed in a MR pipeline image

Context & Configuration

Link to a project, pipeline or job facing the bug: (please provide one if possible)

The issue was reproduced using:

  • Version of the template: 9.3.1
  • GitLab server(s): gitlab.com
  • GitLab runner(s): Tanzu Kubernetes OnPrem

Here is the .gitlab-ci.yml file:

variables:
  DISABLE_ERRORS_LINTERS: "YAML_YAMLLINT,YAML_PRETTIER"
  no_proxy: gcp-auth-provider
  GCP_OIDC_PROVIDER: projects/**/locations/global/workloadIdentityPools/gitlab/providers/gitlab
  GCP_PROJECT_ID: **
  GCP_REGION: europe-west3

include:
  - template: Workflows/MergeRequest-Pipelines.gitlab-ci.yml
  - component: $CI_SERVER_FQDN/to-be-continuous/helm/gitlab-ci-helm@9.3.1
    inputs:
      chart-dir: **
      publish-url: "oci://${GCP_REGION}-docker.pkg.dev/${GCP_PROJECT_ID}/helm-charts"
      publish-on: tag
  - component: $CI_SERVER_FQDN/to-be-continuous/helm/gitlab-ci-helm-gcp@9.3.1
    inputs:
      gcp-oidc-provider: ${GCP_OIDC_PROVIDER}
      gcp-oidc-aud: "https://iam.googleapis.com/${GCP_OIDC_PROVIDER}"
Edited by Stefan Gerasch