Skip to content

ref_name:support/auto_update_kbcli_doc_0.9 release_version:v0.9.3-beta.15 #730

ref_name:support/auto_update_kbcli_doc_0.9 release_version:v0.9.3-beta.15

ref_name:support/auto_update_kbcli_doc_0.9 release_version:v0.9.3-beta.15 #730

Workflow file for this run

name: Release Version
on:
workflow_dispatch:
inputs:
release_version:
description: 'The version of release'
required: true
default: ''
run-name: ref_name:${{ github.ref_name }} release_version:${{ inputs.release_version }}
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
GO_VERSION: "1.21"
jobs:
# release-message:
# uses: apecloud/apecloud-cd/.github/workflows/[email protected]
# with:
# TYPE: "1"
# VERSION: "${{ inputs.release_version }}"
# APECD_REF: "v0.1.38"
# secrets: inherit
#
# release-test:
# runs-on: ubuntu-latest
# strategy:
# fail-fast: true
# matrix:
# ops: [ 'manifests', 'mod-vendor', 'generate', 'lint', 'staticcheck', 'test' ]
# steps:
# - uses: actions/checkout@v4
# - name: install lib
# run: |
# sudo rm /etc/apt/sources.list.d/microsoft-prod.list
# sudo apt-get update
# sudo apt-get install -y --no-install-recommends \
# libbtrfs-dev \
# libdevmapper-dev
#
# - name: Set up Go
# uses: actions/setup-go@v4
# with:
# go-version: "${{ env.GO_VERSION }}"
#
# - name: Install golangci-lint
# if: matrix.ops == 'lint'
# run: |
# curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2
#
# - name: make ${{ matrix.ops }}
# run: |
# make ${{ matrix.ops }}
# FILE_CHANGES=`git diff --name-only ${{ github.sha }}`
# if [[ ("${{ matrix.ops }}" == 'generate' || "${{ matrix.ops }}" == 'manifests') && -n "$FILE_CHANGES" ]]; then
# echo $FILE_CHANGES
# echo "make "${{ matrix.ops }}" causes inconsistent files"
# exit 1
# fi
#
# release-branch:
# needs: release-test
# uses: apecloud/apecloud-cd/.github/workflows/[email protected]
# with:
# RELEASE_VERSION: "${{ inputs.release_version }}"
# RELEASE_BRANCH: "${{ github.ref_name }}"
# APECD_REF: "v0.1.38"
# secrets: inherit
#
# release-addons-version:
# needs: release-branch
# uses: apecloud/apecloud-cd/.github/workflows/[email protected]
# with:
# GITHUB_REPO: "apecloud/kubeblocks-addons"
# VERSION: "${{ inputs.release_version }}"
# BRANCH_NAME: "${{ needs.release-branch.outputs.release-branch }}"
# WORKFLOW_ID: "release-version.yml"
# APECD_REF: "v0.1.38"
# secrets: inherit
#
# release-addons-version-ent:
# needs: release-branch
# uses: apecloud/apecloud-cd/.github/workflows/[email protected]
# with:
# GITHUB_REPO: "apecloud/apecloud-addons"
# VERSION: "${{ inputs.release_version }}"
# BRANCH_NAME: "${{ needs.release-branch.outputs.release-branch }}"
# WORKFLOW_ID: "release-version.yml"
# APECD_REF: "v0.1.38"
# secrets: inherit
release-version:
# needs: [ release-addons-version ]
runs-on: ubuntu-latest
steps:
- name: checkout branch ${{ github.ref_name }}
uses: actions/checkout@v4
with:
token: ${{ env.GITHUB_TOKEN }}
ref: ${{ github.ref_name }}
# - name: install lib
# run: |
# sudo rm /etc/apt/sources.list.d/microsoft-prod.list
# sudo apt-get update
# sudo apt-get install -y --no-install-recommends \
# libbtrfs-dev \
# libdevmapper-dev
#
# - name: Setup Go
# uses: actions/setup-go@v4
# with:
# go-version: "${{ env.GO_VERSION }}"
- name: checkout kbcli code
uses: actions/checkout@v4
with:
repository: apecloud/kbcli
path: kbcli
ref: ${{ github.ref_name }}
token: ${{ env.GITHUB_TOKEN }}
- name: Update kbcli doc
id: update_kbcli_doc
run: |
echo "copy kbcli user docs to kubeblocks docs"
cp -r ${{ github.workspace }}/kbcli/docs/user_docs/cli/* ${{ github.workspace }}/docs/user_docs/cli/
FILE_CHANGES=`git diff --name-only ${{ github.sha }}`
git add ${{ github.workspace }}/docs/user_docs/cli/*
if [[ -n "$FILE_CHANGES" ]]; then
echo $FILE_CHANGES
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
git commit -a -m "chore: auto update kbcli user docs"
fi
echo file_changes=$FILE_CHANGES >> $GITHUB_OUTPUT
RELEASE_COMMIT="$(git rev-parse HEAD)"
echo 'RELEASE_COMMIT='${RELEASE_COMMIT} >> $GITHUB_ENV
# - name: Update apis doc
# id: update_apis_doc
# run: |
# make doc
# FILE_CHANGES=`git diff --name-only ${{ github.sha }}`
# if [[ -n "$FILE_CHANGES" ]]; then
# echo $FILE_CHANGES
# git config --local user.name "$GITHUB_ACTOR"
# git config --local user.email "[email protected]"
# git commit -a -m "chore: auto update apis docs"
# fi
# echo file_changes=$FILE_CHANGES >> $GITHUB_OUTPUT
#
# RELEASE_COMMIT="$(git rev-parse HEAD)"
# echo 'RELEASE_COMMIT='${RELEASE_COMMIT} >> $GITHUB_ENV
#
# - name: Checkout kubeblocks-addons ${{ github.ref_name }}
# uses: actions/checkout@v4
# with:
# repository: apecloud/kubeblocks-addons
# path: kubeblocks-addons
# ref: ${{ github.ref_name }}
#
# - name: upgrade addons version
# id: upgrade_addon_version
# run: |
# addon_dir="${{ github.workspace }}/deploy/helm/templates/addons"
# kb_addon_dir="${{ github.workspace }}/kubeblocks-addons/addons"
# for addon_file in $(ls $addon_dir); do
# addon_name=$(cat $addon_dir/$addon_file | (grep "\"name\"" || true) | awk '{print $2}'| sed 's/"//g')
# addon_version=$(cat $addon_dir/$addon_file | (grep "\"version\"" || true) | awk '{print $2}'| sed 's/"//g')
# if [[ -f $kb_addon_dir/$addon_name/Chart.yaml ]]; then
# kb_addon_version=$(cat $kb_addon_dir/$addon_name/Chart.yaml | yq eval '.version')
# if [[ "$addon_version" != "$kb_addon_version" ]]; then
# echo "upgrade $addon_name version to $kb_addon_version"
# sed -i "s/^ \"version\".*/ \"version\" \"$kb_addon_version\"/" $addon_dir/$addon_file
# fi
# fi
# done
# FILE_CHANGES=`git diff --name-only ${{ env.RELEASE_COMMIT }}`
# if [[ -n "$FILE_CHANGES" ]]; then
# echo $FILE_CHANGES
# git config --local user.name "$GITHUB_ACTOR"
# git config --local user.email "[email protected]"
# git commit -a -m "chore: auto upgrade kubeblocks addons version"
# fi
# echo file_changes=$FILE_CHANGES >> $GITHUB_OUTPUT
#
# RELEASE_COMMIT="$(git rev-parse HEAD)"
# echo 'RELEASE_COMMIT='${RELEASE_COMMIT} >> $GITHUB_ENV
- name: push changes to new branch
if: ${{ steps.update_kbcli_doc.outputs.file_changes && github.ref_name == 'main' }}
uses: ad-m/github-push-action@master
with:
github_token: ${{ env.GITHUB_TOKEN }}
branch: support/auto-update-${{ env.RELEASE_COMMIT }}
- name: auto create pr head new branch
if: ${{ steps.update_kbcli_doc.outputs.file_changes && github.ref_name == 'main' }}
run: |
gh pr create --base "${{ github.ref }}" --head "support/auto-update-${{ env.RELEASE_COMMIT }}" --title "chore: auto upgrade addons version or update apis docs or update kbcli user docs" --body ""
- name: push changes to ${{ github.ref_name }}
uses: ad-m/github-push-action@master
if: ${{ steps.update_kbcli_doc.outputs.file_changes && github.ref_name != 'main' }}
with:
github_token: ${{ env.GITHUB_TOKEN }}
branch: ${{ github.ref_name }}
# - name: push tag ${{ inputs.release_version }}
# uses: mathieudutour/[email protected]
# with:
# custom_tag: ${{ inputs.release_version }}
# github_token: ${{ env.GITHUB_TOKEN }}
# commit_sha: ${{ env.RELEASE_COMMIT }}
# tag_prefix: ""
#
# send-message:
# needs: [ release-version, release-addons-version ]
# if: ${{ failure() || cancelled() }}
# uses: apecloud/apecloud-cd/.github/workflows/[email protected]
# with:
# TYPE: "2"
# CONTENT: "release ${{ inputs.release_version }} error"
# APECD_REF: "v0.1.38"
# secrets: inherit