mirror of
https://github.com/apache/superset.git
synced 2026-05-22 00:05:15 +00:00
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.
This commit is contained in:
2
.github/workflows/superset-helm-lint.yml
vendored
2
.github/workflows/superset-helm-lint.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Lint and Test Charts
|
||||
name: "Helm: lint and test charts"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
44
.github/workflows/superset-helm-release.yml
vendored
44
.github/workflows/superset-helm-release.yml
vendored
@@ -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 }}
|
||||
|
||||
Reference in New Issue
Block a user