Skip to content

ref_name:release-0.9 release_version:v0.9.1 #653

ref_name:release-0.9 release_version:v0.9.1

ref_name:release-0.9 release_version:v0.9.1 #653

name: Releases
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/feishui-message.yml@v0.1.38
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/release-branch.yml@v0.1.38
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/trigger-workflow.yml@v0.1.38
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/trigger-workflow.yml@v0.1.38
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
- 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: Update apis doc
id: update_apis_doc
run: |
make doc
FILE_CHANGES=`git diff --name-only ${{ github.sha }}`
if [[ ! -z "$FILE_CHANGES" ]]; then
echo $FILE_CHANGES
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
git commit -a -m "chore: auto update apis doc changes"
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 [[ ! -z "$FILE_CHANGES" ]]; then
echo $FILE_CHANGES
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
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 addons version changes to new branch
if: ${{ (steps.update_apis_doc.outputs.file_changes || steps.upgrade_addon_version.outputs.file_changes) && (github.ref_name == 'main' || github.ref_name == 'release-0.9') }}
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_apis_doc.outputs.file_changes || steps.upgrade_addon_version.outputs.file_changes) && (github.ref_name == 'main' || github.ref_name == 'release-0.9') }}
run: |
gh pr create --base "${{ github.ref }}" --head "support/auto-update-${{ env.RELEASE_COMMIT }}" --title "chore: auto upgrade addons version or update apis doc" --body ""
- name: push addons version changes
uses: ad-m/github-push-action@master
if: ${{ (steps.update_apis_doc.outputs.file_changes || steps.upgrade_addon_version.outputs.file_changes) && github.ref_name != 'main' && github.ref_name != 'release-0.9' }}
with:
github_token: ${{ env.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- name: push tag ${{ inputs.release_version }}
uses: mathieudutour/github-tag-action@v6.1
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/feishui-message.yml@v0.1.38
with:
TYPE: "2"
CONTENT: "release ${{ inputs.release_version }} error"
APECD_REF: "v0.1.38"
secrets: inherit