You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.4 KiB
78 lines
2.4 KiB
10 months ago
|
# Copyright © 2023 OpenIM. All rights reserved.
|
||
|
#
|
||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
# you may not use this file except in compliance with the License.
|
||
|
# You may obtain a copy of the License at
|
||
|
#
|
||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||
|
#
|
||
|
# Unless required by applicable law or agreed to in writing, software
|
||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
# See the License for the specific language governing permissions and
|
||
|
# limitations under the License.
|
||
|
|
||
1 year ago
|
name: Create Branch on Tag
|
||
|
|
||
|
on:
|
||
|
push:
|
||
|
tags:
|
||
|
- 'v*.*.0'
|
||
|
|
||
10 months ago
|
permissions:
|
||
|
contents: write
|
||
|
actions: write
|
||
|
|
||
1 year ago
|
jobs:
|
||
|
create-branch:
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
- name: Check out code
|
||
11 months ago
|
uses: actions/checkout@v4
|
||
1 year ago
|
with:
|
||
|
fetch-depth: 0
|
||
|
|
||
|
- name: Set up Git
|
||
|
run: |
|
||
|
git config --global user.name 'kubbot'
|
||
|
git config --global user.email '3293172751yxy@gmail.com'
|
||
|
|
||
|
- name: Install git-chglog
|
||
|
run: make install.git-chglog
|
||
|
|
||
10 months ago
|
- name: Create Branch and Push
|
||
|
env:
|
||
|
TAG_NAME: ${{ github.ref_name }}
|
||
1 year ago
|
run: |
|
||
|
IFS='.' read -ra VERSION_PARTS <<< "$TAG_NAME"
|
||
|
if [[ "${VERSION_PARTS[2]}" = "0" ]]; then
|
||
|
BRANCH_NAME="release-v${VERSION_PARTS[0]}.${VERSION_PARTS[1]}"
|
||
|
echo "Creating branch $BRANCH_NAME"
|
||
|
git checkout -b "$BRANCH_NAME"
|
||
|
git push origin "$BRANCH_NAME"
|
||
10 months ago
|
else
|
||
|
echo "Not a release tag. Skipping branch creation."
|
||
1 year ago
|
fi
|
||
10 months ago
|
continue-on-error: true
|
||
1 year ago
|
|
||
10 months ago
|
- name: Create and Commit CHANGELOG
|
||
|
if: endsWith(github.ref_name, '.0')
|
||
1 year ago
|
run: |
|
||
10 months ago
|
git fetch --all
|
||
|
TAG_NAME=${GITHUB_REF#refs/tags/}
|
||
1 year ago
|
IFS='.' read -ra VERSION_PARTS <<< "$TAG_NAME"
|
||
10 months ago
|
git checkout main
|
||
|
cd CHANGELOG
|
||
|
git-chglog --tag-filter-pattern "v${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.*" -o "CHANGELOG-${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.md"
|
||
|
git add "CHANGELOG-${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.md"
|
||
|
git commit -m "Update CHANGELOG for $TAG_NAME" || echo "No changes to commit."
|
||
|
continue-on-error: true
|
||
|
|
||
|
- name: Push CHANGELOG to Main
|
||
|
if: steps.create-and-commit-changelog.outputs.changes == 'true'
|
||
6 months ago
|
uses: ad-m/github-push-action@v0.8.0
|
||
1 year ago
|
with:
|
||
10 months ago
|
github_token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||
1 year ago
|
branch: main
|
||
10 months ago
|
continue-on-error: true
|