mirror of
https://github.com/apache/superset.git
synced 2026-07-30 02:22:31 +00:00
Compare commits
1 Commits
tdd/issue-
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
673f928589 |
93
.github/workflows/superset-helm-release.yml
vendored
93
.github/workflows/superset-helm-release.yml
vendored
@@ -1,6 +1,9 @@
|
||||
# This workflow automates the release process for Helm charts.
|
||||
# The workflow creates a new branch for the release and opens a pull request against the 'gh-pages' branch,
|
||||
# allowing the changes to be reviewed and merged manually.
|
||||
# Each run force-recreates a single 'helm-publish' branch from the tip of 'gh-pages' and
|
||||
# opens (or reuses) one pull request against 'gh-pages', allowing the changes to be
|
||||
# reviewed and merged manually. Because chart-releaser rebuilds index.yaml from all
|
||||
# published GitHub releases, the branch always contains every chart released since the
|
||||
# last merge, and the PR can never go stale or conflict with gh-pages.
|
||||
|
||||
name: "Helm: release charts"
|
||||
|
||||
@@ -18,6 +21,12 @@ on:
|
||||
required: false
|
||||
default: "master"
|
||||
|
||||
# Serialize runs: concurrent runs would race on force-pushing the shared
|
||||
# helm-publish branch while chart-releaser is mid-release.
|
||||
concurrency:
|
||||
group: helm-release
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-26.04
|
||||
@@ -57,9 +66,9 @@ jobs:
|
||||
echo "DEBUG TAGS"
|
||||
git show-ref --tags
|
||||
|
||||
- name: Create unique pages branch name
|
||||
- name: Set pages branch name
|
||||
id: vars
|
||||
run: echo "branch_name=helm-publish-${GITHUB_SHA:0:7}" >> $GITHUB_ENV
|
||||
run: echo "branch_name=helm-publish" >> $GITHUB_ENV
|
||||
|
||||
- name: Force recreate branch from gh-pages
|
||||
env:
|
||||
@@ -97,12 +106,17 @@ jobs:
|
||||
version: v1.6.0
|
||||
charts_dir: helm
|
||||
mark_as_latest: false
|
||||
# A helm/** change without a Chart.yaml version bump repackages the
|
||||
# already-released version; without this, cr aborts on the existing
|
||||
# release tag (422 already_exists) instead of proceeding to rebuild
|
||||
# the index, and the whole run fails.
|
||||
skip_existing: true
|
||||
pages_branch: ${{ env.branch_name }}
|
||||
env:
|
||||
CR_TOKEN: "${{ github.token }}"
|
||||
CR_RELEASE_NAME_TEMPLATE: "superset-helm-chart-{{ .Version }}"
|
||||
|
||||
- name: Open Pull Request
|
||||
- name: Open or reuse Pull Request
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
with:
|
||||
script: |
|
||||
@@ -113,15 +127,72 @@ jobs:
|
||||
throw new Error("Branch name is not defined.");
|
||||
}
|
||||
|
||||
const pr = await github.rest.pulls.create({
|
||||
// The branch is force-recreated from gh-pages on every run, so an
|
||||
// already-open PR for it now reflects this run's charts; opening
|
||||
// another would both fail (422) and recreate the stale-PR pileup
|
||||
// this fixed branch exists to avoid.
|
||||
const { data: existing } = await github.rest.pulls.list({
|
||||
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.`,
|
||||
state: "open",
|
||||
head: `${owner}:${branchName}`,
|
||||
base: "gh-pages",
|
||||
});
|
||||
|
||||
core.info(`Pull request created: ${pr.data.html_url}`);
|
||||
let current;
|
||||
if (existing.length > 0) {
|
||||
current = existing[0];
|
||||
core.info(`Reusing existing pull request: ${current.html_url}`);
|
||||
} else {
|
||||
const { data: pr } = await github.rest.pulls.create({
|
||||
owner,
|
||||
repo,
|
||||
title: "Helm chart release",
|
||||
head: branchName,
|
||||
base: "gh-pages", // Adjust if the target branch is different
|
||||
body: [
|
||||
"This PR releases Helm charts to the gh-pages branch.",
|
||||
"",
|
||||
"It is force-updated from the tip of `gh-pages` by every release run,",
|
||||
"so it always contains every chart released since the last merge and",
|
||||
"never needs to be closed as superseded.",
|
||||
].join("\n"),
|
||||
});
|
||||
current = pr;
|
||||
core.info(`Pull request created: ${current.html_url}`);
|
||||
}
|
||||
|
||||
// Sweep release PRs left open by older runs (per-SHA helm-publish-*
|
||||
// branches from the previous scheme). Their content is a subset of
|
||||
// the evergreen PR, so close them with a pointer to it.
|
||||
const { data: openPrs } = await github.rest.pulls.list({
|
||||
owner,
|
||||
repo,
|
||||
state: "open",
|
||||
base: "gh-pages",
|
||||
per_page: 100,
|
||||
});
|
||||
|
||||
for (const stale of openPrs) {
|
||||
if (
|
||||
stale.number !== current.number &&
|
||||
stale.head.repo?.full_name === process.env.GITHUB_REPOSITORY &&
|
||||
stale.head.ref.startsWith("helm-publish")
|
||||
) {
|
||||
await github.rest.issues.createComment({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: stale.number,
|
||||
body: `Superseded by #${current.number}, which now carries all unreleased charts. Closing.`,
|
||||
});
|
||||
await github.rest.pulls.update({
|
||||
owner,
|
||||
repo,
|
||||
pull_number: stale.number,
|
||||
state: "closed",
|
||||
});
|
||||
core.info(`Closed superseded release PR #${stale.number}`);
|
||||
}
|
||||
}
|
||||
env:
|
||||
BRANCH_NAME: ${{ env.branch_name }}
|
||||
|
||||
Reference in New Issue
Block a user