Skip to content

Update sync_labels_openim.yml #62

Update sync_labels_openim.yml

Update sync_labels_openim.yml #62

# Copyright © 2023 KubeCub open source community. All rights reserved.
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
name: Create Release Branch
on:
push:
branches:
- main
tags:
- 'v*'
jobs:
create_release_branch:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Create release branch
run: |
# Gets the currently pushed tag
TAG_NAME=$(echo "${GITHUB_REF}" | sed -e 's,.*/\(.*\),\1,')
# Check whether the tag format meets expectations
if [[ "${TAG_NAME}" =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
MAJOR_VERSION=${BASH_REMATCH[1]}
MINOR_VERSION=${BASH_REMATCH[2]}
PATCH_VERSION=${BASH_REMATCH[3]}
# 检查是否满足创建分支的条件
if [[ ${PATCH_VERSION} -eq 0 && ! ${TAG_NAME} =~ [A-Za-z-] ]]; then
RELEASE_BRANCH_NAME="release-v${MAJOR_VERSION}.0"
# 创建分支
git branch "${RELEASE_BRANCH_NAME}" "${TAG_NAME}"
git push origin "${RELEASE_BRANCH_NAME}"
echo "Created release branch: ${RELEASE_BRANCH_NAME}"
else
echo "Tag format is invalid or does not meet the conditions. Release branch not created."
fi
else
echo "Tag format is invalid. Release branch not created."
fi