Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add pipeline auto-update Helm Charts and Operator on New Release #16642

Merged
merged 4 commits into from
May 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Update Helm Charts and Risingwave Operator on New Release

on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: 'release version'
required: true

env:
NEW_APP_VERSION: ${{ github.event.inputs.version || github.event.release.tag_name }}

jobs:
update-helm-charts:
runs-on: ubuntu-latest
steps:
- name: Checkout Helm Charts Repository
uses: actions/checkout@v3
with:
repository: 'risingwavelabs/helm-charts'
token: ${{ secrets.GITHUB_TOKEN }}
path: 'helm-charts'

- name: Update values.yaml
run: |
sed -i "s/^ tag:.*/ tag: \"${{ env.NEW_APP_VERSION }}\"/" helm-charts/charts/risingwave/values.yaml

- name: Update Chart.yaml
run: |
cd helm-charts/charts/risingwave
CURRENT_VERSION=$(grep 'version:' Chart.yaml | awk '{print $2}' | head -n 1)
NEW_VERSION=$(echo $CURRENT_VERSION | awk -F. -v OFS='.' '{$NF++; print}')
sed -i "/type: application/,/version:/!b; /version:/s/version: .*/version: $NEW_VERSION/" Chart.yaml
sed -i "s/^appVersion: .*/appVersion: \"${{ env.NEW_APP_VERSION }}\"/" Chart.yaml
echo "NEW_CHART_VERSION=$NEW_VERSION" >> $GITHUB_ENV

- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'chore: bump risingwave to ${{ env.NEW_APP_VERSION }}, release chart ${{ env.NEW_CHART_VERSION }}'
title: 'chore: bump risingwave to ${{ env.NEW_APP_VERSION }}, release chart ${{ env.NEW_CHART_VERSION }}'
body: 'This is an automated pull request to update the chart versions'
branch: 'auto-update-${{ env.NEW_APP_VERSION }}'

update-risingwave-operator:
runs-on: ubuntu-latest
steps:
- name: Checkout Risingwave Operator Repository
uses: actions/checkout@v3
with:
repository: 'risingwavelabs/risingwave-operator'
token: ${{ secrets.GITHUB_TOKEN }}
path: 'risingwave-operator'

- name: Update risingwave-operator image tags
run: |
cd risingwave-operator
PREV_VERSION=$(grep -roh "risingwavelabs/risingwave:v[0-9\.]*" * | head -n 1 | cut -d':' -f2)
grep -rl "risingwavelabs/risingwave:$PREV_VERSION" . | xargs sed -i "s|risingwavelabs/risingwave:$PREV_VERSION|risingwavelabs/risingwave:${{ env.NEW_APP_VERSION }}|g"

- name: Create Pull Request for risingwave-operator
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'chore: bump risingwave image tags to ${{ env.NEW_APP_VERSION }}'
title: 'chore: bump risingwave image tags to ${{ env.NEW_APP_VERSION }}'
body: 'This is an automated pull request to update the risingwave image tags'
branch: 'auto-update-${{ env.NEW_APP_VERSION }}'
Loading