You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2024/11/25 21:23:03 UTC
(superset) 01/01: fix: helm chart deploy to open PRs to now-protected gh-pages branch
This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch helm_fix
in repository https://gitbox.apache.org/repos/asf/superset.git
commit a2ae36e8249f13f241e79f9d2770a9f4d5deea49
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Mon Nov 25 13:20:16 2024 -0800
fix: helm chart deploy to open PRs to now-protected gh-pages branch
Cleaning up the mess I created by deleting the `gh-pages` branch by mistake while deleting hundreds of stale branches in the repo.
The changes here make it such that pushing a new helm chart version will now open a PR against the now-protected `gh-pages` branch, require a review and merge to be deployed.
---
.github/workflows/superset-helm-lint.yml | 2 +-
.github/workflows/superset-helm-release.yml | 44 +++++++++++++++++++++++++++--
2 files changed, 43 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/superset-helm-lint.yml b/.github/workflows/superset-helm-lint.yml
index 5649f491a4..36ef523fe4 100644
--- a/.github/workflows/superset-helm-lint.yml
+++ b/.github/workflows/superset-helm-lint.yml
@@ -1,4 +1,4 @@
-name: Lint and Test Charts
+name: "Helm: lint and test charts"
on:
pull_request:
diff --git a/.github/workflows/superset-helm-release.yml b/.github/workflows/superset-helm-release.yml
index 24486e14b6..19e76614b5 100644
--- a/.github/workflows/superset-helm-release.yml
+++ b/.github/workflows/superset-helm-release.yml
@@ -1,4 +1,4 @@
-name: Release Charts
+name: "Helm: release charts"
on:
push:
@@ -7,17 +7,25 @@ on:
- "[0-9].[0-9]*"
paths:
- "helm/**"
+ workflow_dispatch:
+ inputs:
+ ref:
+ description: "The branch, tag, or commit SHA to check out"
+ required: false
+ default: "master"
jobs:
release:
runs-on: ubuntu-22.04
permissions:
contents: write
+ pull-requests: write
steps:
- - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
+ - name: Checkout code
uses: actions/checkout@v4
with:
+ ref: ${{ inputs.ref }}
persist-credentials: false
submodules: recursive
fetch-depth: 0
@@ -35,11 +43,43 @@ jobs:
- name: Add bitnami repo dependency
run: helm repo add bitnami https://charts.bitnami.com/bitnami
+ - name: Create unique pages branch name
+ id: vars
+ run: echo "branch_name=helm-publish-${GITHUB_SHA:0:7}" >> $GITHUB_ENV
+
- name: Run chart-releaser
uses: ./.github/actions/chart-releaser-action
with:
charts_dir: helm
mark_as_latest: false
+ pages_branch: ${{ env.branch_name }}
env:
CR_TOKEN: "${{ github.token }}"
CR_RELEASE_NAME_TEMPLATE: "superset-helm-chart-{{ .Version }}"
+
+ - name: Push changes to new branch
+ run: |
+ git checkout -b ${{ env.branch_name }}
+ git add .
+ git commit -m "Release Helm charts"
+ git push origin ${{ env.branch_name }}
+
+ - name: Open Pull Request
+ uses: actions/github-script@v7
+ with:
+ script: |
+ const branchName = process.env.BRANCH_NAME;
+ const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/');
+
+ const pr = await github.pulls.create({
+ owner,
+ repo,
+ title: `Helm chart release for ${branchName}`,
+ head: branchName,
+ base: "gh-pages", // Adjust if the target branch is different
+ body: `This PR releases Helm charts to the gh-pages branch.`,
+ });
+
+ core.info(`Pull request created: ${pr.data.html_url}`);
+ env:
+ BRANCH_NAME: ${{ env.branch_name }}