Skip to content
Snippets Groups Projects
Rules.yaml 1.37 KiB
Newer Older
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
###############################################################################
# Define rules templates to be used by jobs
###############################################################################
# Rules used by default
.default_rules:
  rules:
    # Exclude $CI_DEFAULT_BRANCH of semantic-release commits
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE =~ /^chore\(release\):/
      when: never
    # All branches
    - if: $CI_COMMIT_BRANCH

# Build on branches and release tag push
.build_rules:
  rules:
    # Exclude $CI_DEFAULT_BRANCH of semantic-release commits
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE =~ /^chore\(release\):/
      when: never
    # All branches
    - if: $CI_COMMIT_BRANCH
    # Only for protected release tags
    - if: $CI_COMMIT_TAG =~ /^release\// && $CI_COMMIT_REF_PROTECTED

# Run semantic release only on $CI_DEFAULT_BRANCH except for release commits
.release_rules:
  rules:
    # Exclude $CI_DEFAULT_BRANCH of semantic-release commits
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE =~ /^chore\(release\):/
      when: never
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

# Run on published release tags
.tag_rules:
  rules:
    # Only for protected release tags
    - if: $CI_COMMIT_TAG =~ /^release\// && $CI_COMMIT_REF_PROTECTED
...