From a5bcdea32f9ca08b34cd04e9034bc7e38030b1a4 Mon Sep 17 00:00:00 2001 From: centdix <40307056+centdix@users.noreply.github.com> Date: Thu, 15 May 2025 19:08:52 +0200 Subject: [PATCH] bump helm chart on new release (#5751) --- .github/workflows/helmchart_on_release.yml | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/helmchart_on_release.yml diff --git a/.github/workflows/helmchart_on_release.yml b/.github/workflows/helmchart_on_release.yml new file mode 100644 index 0000000000..1d63cbc326 --- /dev/null +++ b/.github/workflows/helmchart_on_release.yml @@ -0,0 +1,66 @@ +name: Publish Helm Chart on Release + +on: + release: + types: [published] + +jobs: + bump-helm-version: + runs-on: ubicloud-standard-2 + + steps: + - name: Checkout on helm repository + uses: actions/checkout@v3 + with: + repository: windmill-labs/windmill-helm-charts + token: ${{ secrets.DOCS_TOKEN }} + + - name: Get version + id: get_version + run: | + echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV + + - name: Create new branch + run: | + # Check if branch already exists remotely + if git ls-remote --heads origin bump-helm-version-${{ env.VERSION }} | grep -q bump-helm-version-${{ env.VERSION }}; then + # Branch exists, check it out + git fetch origin bump-helm-version-${{ env.VERSION }} + git checkout bump-helm-version-${{ env.VERSION }} + else + # Create new branch + git checkout -b bump-helm-version-${{ env.VERSION }} + fi + + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + + - name: Bump helm version + run: | + # Get current version and increment it by 1 + CURRENT_VERSION=$(grep "version:" ./charts/windmill/Chart.yaml | awk '{print $2}' | head -n 1) + NEW_VERSION=$(echo "$CURRENT_VERSION" | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g') + sed -i "s/^version: .*/version: $NEW_VERSION/" ./charts/windmill/Chart.yaml + + # Get the app version from the version + VERSION=${{ env.VERSION }} + APP_VERSION=${VERSION#refs/tag/} + APP_VERSION=${APP_VERSION#v} + APP_VERSION=${APP_VERSION%/} + sed -i "s/appVersion: .*/appVersion: $APP_VERSION/" ./charts/windmill/Chart.yaml + + - name: Commit and push + run: | + git add . + git commit -m "Bump helm version to ${{ env.VERSION }}" + git push origin bump-helm-version-${{ env.VERSION }} + + - name: Create PR + env: + GH_TOKEN: ${{ secrets.DOCS_TOKEN }} + run: | + gh pr create \ + --title "helm: bump version to ${{ env.VERSION }}" \ + --body "This PR was auto-generated to bring the helm chart up to date for [release ${{ env.VERSION }}](https://github.com/windmill-labs/windmill/releases/tag/v${{ env.VERSION }}) in the main repo." \ + --head bump-helm-version-${{ env.VERSION }} \ + --base main