mergegitlabcontinuous-integration

Gitlab CI Pipeline that runs after merge is done


I want to run specific script to move tags to main branch, after merge with develop branch is done with .gitlab-ci.yml.

The goal is to run job AFTER merge is done, I couldn't find appropriate way to do it. I tried to work with "merged results pipeline", but I don't know to to limit it to run only after merge is done.


Solution

  • Below I paste the code that worked for me.

    move_tags:
      stage: move_tags
      allow_failure: true
      timeout: 24h
      rules:
        - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
          when: never
        - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "main"'
          when: manual