11name : " [Pre-Release] Helm Chart"
22description : " Publish pre-release Helm charts"
33
4- # Triggered when [CI][Helm] Auto-bump Chart Versions workflow completes
54on :
6- workflow_run :
7- workflows : ["[CI][Helm] Auto-bump Chart Versions"]
8- types :
9- - completed
10- branches :
11- - main
12- - ' prebuild/**'
5+ # Called directly from helm-rc-version-bump workflow
6+ workflow_call :
7+ inputs :
8+ pr_number :
9+ description : ' PR number to publish pre-release for'
10+ required : true
11+ type : number
12+ new_commit :
13+ description : ' Whether a new commit was made by version bump'
14+ required : false
15+ type : boolean
16+ default : false
1317
1418permissions :
1519 contents : read
@@ -21,47 +25,18 @@ jobs:
2125 publish-pre-release :
2226 name : Publish Pre-release Helm Chart
2327 runs-on : ubuntu-latest
24- # Only run if the triggering workflow succeeded
25- if : github.event.workflow_run.conclusion == 'success'
28+ # Skip if a new commit was made (will re-run on next trigger)
29+ if : ${{ !inputs.new_commit }}
2630
2731 steps :
28- - name : 📥 Download version bump status artifact
29- uses : actions/download-artifact@v7
30- with :
31- name : version-bump-status
32- run-id : ${{ github.event.workflow_run.id }}
33- github-token : ${{ secrets.GITHUB_TOKEN }}
34-
35- - name : 📋 Read version bump status
32+ - name : 📋 Set PR info from inputs
3633 id : bump-status
3734 run : |
38- if [[ -f "version-bump-status.txt" ]]; then
39- echo "📋 Version bump status:"
40- cat version-bump-status.txt
41-
42- # Parse the status file
43- NEW_COMMIT=$(grep "^new_commit=" version-bump-status.txt | cut -d'=' -f2)
44- PR_NUMBER=$(grep "^pr_number=" version-bump-status.txt | cut -d'=' -f2)
45- HEAD_SHA=$(grep "^head_sha=" version-bump-status.txt | cut -d'=' -f2)
46-
47- echo "new_commit=$NEW_COMMIT" >> $GITHUB_OUTPUT
48- echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT
49- echo "head_sha=$HEAD_SHA" >> $GITHUB_OUTPUT
50-
51- if [[ "$NEW_COMMIT" == "true" ]]; then
52- echo "🔄 Version bump workflow made a new commit - skipping pre-release"
53- echo "skip=true" >> $GITHUB_OUTPUT
54- else
55- echo "✅ No new commit from version bump - proceeding with pre-release"
56- echo "skip=false" >> $GITHUB_OUTPUT
57- fi
58- else
59- echo "⚠️ No version bump status file found"
60- echo "skip=false" >> $GITHUB_OUTPUT
61- fi
35+ echo "pr_number=${{ inputs.pr_number }}" >> $GITHUB_OUTPUT
36+ echo "skip=false" >> $GITHUB_OUTPUT
37+ echo "📋 Processing PR #${{ inputs.pr_number }}"
6238
6339 - name : 🔍 Get PR details
64- if : steps.bump-status.outputs.skip != 'true'
6540 id : pr-info
6641 uses : actions/github-script@v8
6742 with :
@@ -88,49 +63,13 @@ jobs:
8863 console.log(`Head SHA: ${pr.head.sha}`);
8964 console.log(`Labels: ${pr.labels.map(l => l.name).join(', ')}`);
9065
91- - name : 🔍 Check if pre-release should run
92- if : steps.bump-status.outputs.skip != 'true'
93- id : should-run
94- run : |
95- HEAD_REF="${{ steps.pr-info.outputs.head_ref }}"
96- HEAD_REPO="${{ steps.pr-info.outputs.head_repo_full_name }}"
97- LABELS="${{ steps.pr-info.outputs.labels }}"
98- REPO="${{ github.repository }}"
99-
100- echo "🔍 Checking pre-release conditions..."
101- echo " Branch: $HEAD_REF"
102- echo " Repo: $HEAD_REPO"
103- echo " Labels: $LABELS"
104-
105- SHOULD_RUN=false
106-
107- # Check for prebuild/ branch from same repo
108- if [[ "$HEAD_REPO" == "$REPO" && "$HEAD_REF" == prebuild/* ]]; then
109- echo "✅ Matched: prebuild/ branch from same repo"
110- SHOULD_RUN=true
111- fi
112-
113- # Check for helm-prerelease label
114- if [[ "$LABELS" == *"helm-prerelease"* ]]; then
115- echo "✅ Matched: helm-prerelease label"
116- SHOULD_RUN=true
117- fi
118-
119- echo "should_run=$SHOULD_RUN" >> $GITHUB_OUTPUT
120-
121- if [[ "$SHOULD_RUN" != "true" ]]; then
122- echo "ℹ️ Skipping pre-release - conditions not met"
123- fi
124-
12566 - name : 📥 Checkout repository
126- if : steps.bump-status.outputs.skip != 'true' && steps.should-run.outputs.should_run == 'true'
12767 uses : actions/checkout@v6
12868 with :
12969 ref : ${{ steps.pr-info.outputs.head_sha }}
13070 fetch-depth : 0
13171
13272 - name : 🔍 Check if chart versions are bumped
133- if : steps.bump-status.outputs.skip != 'true' && steps.should-run.outputs.should_run == 'true'
13473 id : version-check
13574 run : |
13675 git fetch origin main
@@ -185,18 +124,18 @@ jobs:
185124 fi
186125
187126 - name : ⚙️ Set up Helm
188- if : steps.bump-status.outputs.skip != 'true' && steps.should-run.outputs.should_run == 'true' && steps. version-check.outputs.skip != 'true'
127+ if : steps.version-check.outputs.skip != 'true'
189128 uses : azure/setup-helm@v4
190129 with :
191130 version : v3.14.0
192131
193132 - name : 🔐 Login to GHCR
194- if : steps.bump-status.outputs.skip != 'true' && steps.should-run.outputs.should_run == 'true' && steps. version-check.outputs.skip != 'true'
133+ if : steps.version-check.outputs.skip != 'true'
195134 run : |
196135 echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io -u ${{ github.actor }} --password-stdin
197136
198137 - name : 🔍 Detect Changed Charts
199- if : steps.bump-status.outputs.skip != 'true' && steps.should-run.outputs.should_run == 'true' && steps. version-check.outputs.skip != 'true'
138+ if : steps.version-check.outputs.skip != 'true'
200139 id : detect
201140 run : |
202141 # Detect which charts have changes (excluding Chart.lock only changes)
@@ -236,7 +175,7 @@ jobs:
236175 echo "ai-platform-changed=$AI_PLATFORM_CHANGED" >> $GITHUB_OUTPUT
237176
238177 - name : 🏷️ Generate Pre-release Versions
239- if : steps.bump-status.outputs.skip != 'true' && steps.should-run.outputs.should_run == 'true' && steps. version-check.outputs.skip != 'true'
178+ if : steps.version-check.outputs.skip != 'true'
240179 id : version
241180 run : |
242181 # Get branch name and remove 'prebuild/' prefix if present
@@ -284,7 +223,7 @@ jobs:
284223 fi
285224
286225 - name : 📦 Package rag-stack Chart
287- if : steps.bump-status.outputs.skip != 'true' && steps.should-run.outputs.should_run == 'true' && steps. version-check.outputs.skip != 'true' && steps.detect.outputs.rag-stack-changed == 'true'
226+ if : steps.version-check.outputs.skip != 'true' && steps.detect.outputs.rag-stack-changed == 'true'
288227 run : |
289228 echo "📦 Packaging rag-stack..."
290229
@@ -300,7 +239,7 @@ jobs:
300239 echo "✅ rag-stack packaged successfully"
301240
302241 - name : 📦 Package ai-platform-engineering Chart
303- if : steps.bump-status.outputs.skip != 'true' && steps.should-run.outputs.should_run == 'true' && steps. version-check.outputs.skip != 'true' && steps.detect.outputs.ai-platform-changed == 'true'
242+ if : steps.version-check.outputs.skip != 'true' && steps.detect.outputs.ai-platform-changed == 'true'
304243 run : |
305244 echo "📦 Packaging ai-platform-engineering..."
306245
@@ -345,7 +284,7 @@ jobs:
345284 echo "✅ ai-platform-engineering packaged successfully with all dependencies"
346285
347286 - name : 🚀 Push Pre-release Charts to GHCR
348- if : steps.bump-status.outputs.skip != 'true' && steps.should-run.outputs.should_run == 'true' && steps. version-check.outputs.skip != 'true'
287+ if : steps.version-check.outputs.skip != 'true'
349288 run : |
350289 REGISTRY="oci://ghcr.io/${{ github.repository_owner }}/pre-release-helm-charts"
351290
@@ -363,7 +302,7 @@ jobs:
363302 done
364303
365304 - name : 💬 Comment on PR
366- if : steps.bump-status.outputs.skip != 'true' && steps.should-run.outputs.should_run == 'true' && steps. version-check.outputs.skip != 'true'
305+ if : steps.version-check.outputs.skip != 'true'
367306 uses : actions/github-script@v8
368307 with :
369308 script : |
0 commit comments