Automatic latest release

Hello,

I’m trying to setup my CI to automatically creating releases. I have to scenarios:

  • push to master: a “latest” release shall be created. After another push this release will be overwritten
  • create a tag on master: create a unique release which will never be overwritten.

The stable release job looks like below. For stable releases this works, because the tag_name changes every time. But for latest I would like to use a tag like “latest” which should be moved once a new commit is on master. This does not work with the keyword “release” because a release with that tag already exists.
Is there a way to overwrite the release?

stable release:
  stage: deploy
  image: registry.gitlab.com/gitlab-org/release-cli:latest
  rules:
    - if: $CI_COMMIT_TAG
  artifacts: # artifacts the release refer
    expire_in: never
    paths:
      - $UDPLogger_ID/UDPLogger.flatpak
  script:
    - echo "Creating stable release"
  release:
    name: "Release $CI_COMMIT_TAG"
    tag_name: $COMMIT_TAG
    description: "Release"
    assets:
      links:
        - name: Flatpak
          url: "https://gitlab.com/Murmele/UDPLogger/-/jobs/${CI_JOB_ID}/artifacts/file/$UDPLogger_ID/UDPLogger.flatpak"

Currently I am testing the scenario here: Automatic Release (!8) · Merge requests · Murmele / UDPLogger · GitLab