diff --git a/.github/scripts/update-helm-charts-version.sh b/.github/scripts/update-helm-charts-version.sh new file mode 100755 index 0000000000..f1cd457e84 --- /dev/null +++ b/.github/scripts/update-helm-charts-version.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +set -e + +VERSION=${VERSION} +GITHUB_TOKEN=${GITHUB_TOKEN} + +update_helm_charts_version() { + # Configure Git configs. + git config --global user.email update-helm-charts-version@greptime.com + git config --global user.name update-helm-charts-version + + # Clone helm-charts repository. + git clone "https://x-access-token:${GITHUB_TOKEN}@github.com/GreptimeTeam/helm-charts.git" + cd helm-charts + + # Set default remote for gh CLI + gh repo set-default GreptimeTeam/helm-charts + + # Checkout a new branch. + BRANCH_NAME="chore/greptimedb-${VERSION}" + git checkout -b $BRANCH_NAME + + # Update version. + make update-version CHART=greptimedb-cluster VERSION=${VERSION} + make update-version CHART=greptimedb-standalone VERSION=${VERSION} + + # Update docs. + make docs + + # Commit the changes. + git add . + git commit -m "chore: Update GreptimeDB version to ${VERSION}" + git push origin $BRANCH_NAME + + # Create a Pull Request. + gh pr create \ + --title "chore: Update GreptimeDB version to ${VERSION}" \ + --body "This PR updates the GreptimeDB version." \ + --base main \ + --head $BRANCH_NAME \ + --reviewer zyy17 \ + --reviewer daviderli614 +} + +update_helm_charts_version diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b3737d28fe..468eefc640 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -487,6 +487,27 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} WEBSITE_REPO_TOKEN: ${{ secrets.WEBSITE_REPO_TOKEN }} + bump-helm-charts-version: + name: Bump helm charts version + if: ${{ github.ref_type == 'tag' && !contains(github.ref_name, 'nightly') && github.event_name != 'schedule' }} + needs: [publish-github-release] + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Create Pull Request + env: + GITHUB_TOKEN: ${{ secrets.HELM_CHARTS_REPO_TOKEN }} + VERSION: ${{ needs.allocate-runners.outputs.version }} + run: | + ./.github/scripts/update-helm-charts-version.sh + notification: if: ${{ github.repository == 'GreptimeTeam/greptimedb' && (github.event_name == 'push' || github.event_name == 'schedule') && always() }} name: Send notification to Greptime team