feat: helm publish manual trigger support (#2732)

This commit is contained in:
majinghe
2026-04-29 14:01:22 +08:00
committed by GitHub
parent c9622611ed
commit 946755aa89
2 changed files with 33 additions and 26 deletions
+23 -11
View File
@@ -18,6 +18,13 @@ on:
workflow_run:
workflows: [ "Build and Release" ]
types: [ completed ]
workflow_dispatch:
inputs:
version:
description: "Release version to publish, e.g. 1.0.0-beta.1 or v1.0.0-beta.1"
required: true
default: "1.0.0-beta.1"
type: string
permissions:
contents: read
@@ -25,11 +32,13 @@ permissions:
jobs:
build-helm-package:
runs-on: ubicloud-standard-2
# Only run on successful builds triggered by tag pushes (version format: x.y.z or x.y.z-suffix)
if: |
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'push' &&
contains(github.event.workflow_run.head_branch, '.')
github.event_name == 'workflow_dispatch' ||
(
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'push' &&
contains(github.event.workflow_run.head_branch, '.')
)
outputs:
raw_tag: ${{ steps.version.outputs.raw_tag }}
@@ -44,7 +53,11 @@ jobs:
run: |
set -eux
RAW="${{ github.event.workflow_run.head_branch }}"
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
RAW="${{ github.event.inputs.version }}"
else
RAW="${{ github.event.workflow_run.head_branch }}"
fi
case "$RAW" in
refs/tags/*)
@@ -65,12 +78,10 @@ jobs:
echo "raw_tag=$RAW_TAG" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "raw_tag=$RAW_TAG"
echo "version=$VERSION"
- name: Replace chart app version
- name: Replace chart version and app version
run: |
set -eux
sed -i -E 's/^version:.*/version: "${{ steps.version.outputs.version }}"/' helm/rustfs/Chart.yaml
sed -i -E 's/^appVersion:.*/appVersion: "${{ steps.version.outputs.version }}"/' helm/rustfs/Chart.yaml
- name: Set up Helm
@@ -78,6 +89,7 @@ jobs:
- name: Package Helm Chart
run: |
set -eux
cp helm/README.md helm/rustfs/
helm package ./helm/rustfs \
--destination helm/rustfs/ \
@@ -116,9 +128,9 @@ jobs:
- name: Push helm package and index file
run: |
set -eux
git config --global user.name "${{ secrets.USERNAME }}"
git config --global user.email "${{ secrets.EMAIL_ADDRESS }}"
git status .
git add .
git commit -m "Update rustfs helm package with ${{ needs.build-helm-package.outputs.version }}."
git commit -m "Update rustfs helm package with ${{ needs.build-helm-package.outputs.version }}." || echo "No changes to commit"
git push origin main