Skip to content

fix(backend): 修复主备负责人写入报错的问题 #2570 #10

fix(backend): 修复主备负责人写入报错的问题 #2570

fix(backend): 修复主备负责人写入报错的问题 #2570 #10

name: Auto Create Release
on:
push:
branches:
- "v[0-9]+.[0-9]+.[0-9]+"
paths:
- "helm-charts/bk-dbm/Chart.yaml"
jobs:
build:
runs-on: ubuntu-20.04
steps:
- id: checkout
name: Checkout
uses: actions/checkout@v2
- id: get-current-branch
name: Get current branch
run: |
git fetch --all --tags
current_branch=$(git branch --show-current)
echo "current_branch=$current_branch" >> $GITHUB_OUTPUT
- id: get-latest-tag
name: Get latest tag
run: |
git fetch --all --tags
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "latest_tag=$latest_tag" >> $GITHUB_OUTPUT
- id: yaml-data
name: Run read-yaml action
uses: jbutcher5/read-yaml@main
with:
file: 'helm-charts/bk-dbm/Chart.yaml'
key-path: '["version"]'
- id: create-tag
name: Create tag
uses: actions/github-script@v6
with:
script: |
// Create a lightweight tag
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ steps.yaml-data.outputs.data }}',
sha: context.sha
});
- id: build-release-log
name: Build release log
uses: mikepenz/release-changelog-builder-action@v3.5.0
with:
# 参考:https://github.com/mikepenz/release-changelog-builder-action
configuration: ".github/configuration.json"
commitMode: true
ignorePreReleases: false
fromTag: ${{ steps.get-latest-tag.outputs.latest_tag }}
toTag: ${{ steps.yaml-data.outputs.data }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: create-release
name: Create release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.yaml-data.outputs.data }}
release_name: ${{ steps.yaml-data.outputs.data }}
body: ${{ steps.build-release-log.outputs.changelog }}
draft: false
prerelease: true
- name: Auto Add Release File
id: add-release-file
run: |
filename="dbm-ui/release/V${{ steps.yaml-data.outputs.data }}_$(date +%Y%m%d).md"
echo -e "## ${{ steps.yaml-data.outputs.data }} - $(date +%Y-%m-%d)\n\n" > ${filename}
echo -e "${{ steps.build-release-log.outputs.changelog }}" >> ${filename}
sed -i -E 's/#([0-9]+)/[#\1](https:\/\/github.com\/TencentBlueKing\/blueking-dbm\/issues\/\1)/g' ${filename}
cat ${filename}
git config --global user.email github-actions@users.noreply.github.com
git config --global user.name github-actions
git remote set-url origin https://x-access-token:${{ secrets.WORKFLOW_ACTION_TOKEN }}@github.com/$GITHUB_REPOSITORY
git add .
git commit -m "docs: release version ${{ steps.yaml-data.outputs.data }} #1"
git push origin ${{ steps.get-current-branch.outputs.current_branch }}