Simplify central CI workflow while preserving runner-safe gating.

Remove unused inputs and the extra meta job, and keep a single stable flow where build snapshots ci_steps for sonar/deploy conditions.

Made-with: Cursor
This commit is contained in:
WDI-Ideas
2026-04-08 13:13:49 +05:30
parent e3df003a26
commit 26754e63e3

View File

@@ -3,12 +3,6 @@ name: Central CI
on:
workflow_call:
inputs:
# WDIPL-Runner v0.2.12: only the first truthy workflow_call flag reached nested jobs; the rest
# were empty. Use ONE comma-separated input so Act forwards a single string with all steps.
# Tokens: build, sonar, deploy (e.g. build,sonar,deploy). No spaces — WDIPL-Runner has no replace().
# WDIPL-Runner: needs.meta.outputs is empty when evaluating sonar after a reusable child completes.
# Reusable workflow outputs from build.yml did not surface as needs.build.outputs.cs. Inline `build` job
# below snapshots ci_steps into job outputs (same pattern as `meta`) so sonar/deploy see needs.build.outputs.cs.
ci_steps:
type: string
required: true
@@ -19,13 +13,9 @@ on:
type: string
required: true
# Variables
app_path_beta:
type: string
required: false
app_path_testing:
type: string
required: false
app_path_staging:
type: string
required: false
@@ -35,19 +25,9 @@ on:
build_command:
type: string
required: false
deploy_command:
type: string
required: false
runtime:
type: string
required: false
pm2_id:
type: string
required: false
# Set to 'true' to skip npm install / npm run build (temporary pipeline debugging).
skip_node_compile:
type: string
required: false
secrets:
SONARQUBE_HOST:
@@ -89,26 +69,14 @@ on:
required: false
jobs:
meta:
runs-on: ubuntu-latest
steps:
- name: Capture ci_steps for later job if
id: snap
run: echo "cs=${{ inputs.ci_steps }}" >> "$GITHUB_OUTPUT"
outputs:
cs: ${{ steps.snap.outputs.cs }}
# 🔨 BUILD (inlined — reusable build.yml outputs are not exposed to this parent on WDIPL-Runner)
build:
if: ${{ contains(format(',{0},', needs.meta.outputs.cs), ',build,') }}
needs: [meta]
if: ${{ contains(format(',{0},', inputs.ci_steps), ',build,') }}
runs-on: ubuntu-latest
outputs:
cs: ${{ steps.capture.outputs.cs }}
steps:
- id: capture
name: Capture ci_steps for sonar/deploy if
name: Capture ci_steps
run: echo "cs=${{ inputs.ci_steps }}" >> "$GITHUB_OUTPUT"
- name: Checkout Code
@@ -123,10 +91,6 @@ jobs:
- name: Build (Node / React / NestJS)
if: inputs.tech_stack == 'node' || inputs.tech_stack == 'react' || inputs.tech_stack == 'nestjs'
run: |
if [ "${{ inputs.skip_node_compile }}" = "true" ]; then
echo "TEMP: skip npm install / npm run build (skip_node_compile=true)"
exit 0
fi
if [ -n "${{ inputs.build_command }}" ]; then
set -xe
echo "Running custom build command"
@@ -137,10 +101,9 @@ jobs:
npm run build
fi
# 🔍 SONAR
sonar:
if: ${{ contains(format(',{0},', needs.build.outputs.cs), ',sonar,') }}
needs: [meta, build]
needs: [build]
uses: Rajendra.Reddy/wdipl-actions/.gitea/workflows/quality.yml@d604440af823c664b2c828a3d6a2cc5d23b79141
with:
project_key: ${{ github.event.repository.name }}
@@ -149,10 +112,9 @@ jobs:
SONARQUBE_HOST: ${{ secrets.SONARQUBE_HOST }}
SONARQUBE_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
# 🚀 DEPLOY (runs after build; sonar may be skipped)
deploy:
if: ${{ always() && contains(format(',{0},', needs.build.outputs.cs), ',deploy,') && needs.build.result == 'success' && (needs.sonar.result == 'success' || needs.sonar.result == 'skipped') }}
needs: [meta, build, sonar]
needs: [build, sonar]
uses: Rajendra.Reddy/wdipl-actions/.gitea/workflows/deploy.yml@main
with:
tech_stack: ${{ inputs.tech_stack }}