diff --git a/.github/scripts/update-homebrew-greptme-version.sh b/.github/scripts/update-homebrew-greptme-version.sh new file mode 100755 index 0000000000..8bde376b62 --- /dev/null +++ b/.github/scripts/update-homebrew-greptme-version.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +set -e + +VERSION=${VERSION} +GITHUB_TOKEN=${GITHUB_TOKEN} + +update_homebrew_greptime_version() { + # Configure Git configs. + git config --global user.email update-greptime-version@greptime.com + git config --global user.name update-greptime-version + + # Clone helm-charts repository. + git clone "https://x-access-token:${GITHUB_TOKEN}@github.com/GreptimeTeam/homebrew-greptime.git" + cd homebrew-greptime + + # Set default remote for gh CLI + gh repo set-default GreptimeTeam/homebrew-greptime + + # Checkout a new branch. + BRANCH_NAME="chore/greptimedb-${VERSION}" + git checkout -b $BRANCH_NAME + + # Update version. + make update-greptime-version VERSION=${VERSION} + + # 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_homebrew_greptime_version diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 468eefc640..05f442e1c8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -501,13 +501,34 @@ jobs: with: fetch-depth: 0 - - name: Create Pull Request + - name: Bump helm charts version env: GITHUB_TOKEN: ${{ secrets.HELM_CHARTS_REPO_TOKEN }} VERSION: ${{ needs.allocate-runners.outputs.version }} run: | ./.github/scripts/update-helm-charts-version.sh + bump-homebrew-greptime-version: + name: Bump homebrew greptime 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: Bump homebrew greptime version + env: + GITHUB_TOKEN: ${{ secrets.HOMEBREW_GREPTIME_REPO_TOKEN }} + VERSION: ${{ needs.allocate-runners.outputs.version }} + run: | + ./.github/scripts/update-homebrew-greptme-version.sh + notification: if: ${{ github.repository == 'GreptimeTeam/greptimedb' && (github.event_name == 'push' || github.event_name == 'schedule') && always() }} name: Send notification to Greptime team