@@ -39,6 +39,12 @@ inputs:
3939 publish-and-sign :
4040 description : Whether to publish and sign the packaged Helm Chart. Can be "true" or "false"
4141 default : " true"
42+ merge-registry-values :
43+ description : |
44+ Whether to merge a registry specific values.yaml file with the common one. Can be "true" or
45+ "false". The naming convention is as follows: `{chart-directory}/values/{chart-registry-uri}.yaml`
46+ default : " true"
47+
4248runs :
4349 using : composite
4450 steps :
7581 username : ${{ inputs.chart-registry-username }}
7682 password : ${{ inputs.chart-registry-password }}
7783
84+ - name : Merge publish target specific values.yaml files
85+ if : inputs.merge-registry-values == 'true'
86+ env :
87+ CHART_REGISTRY_URI : ${{ inputs.chart-registry-uri }}
88+ CHART_DIRECTORY : ${{ inputs.chart-directory }}
89+ GITHUB_DEBUG : ${{ runner.debug }}
90+ shell : bash
91+ run : |
92+ set -euo pipefail
93+ [ -n "$GITHUB_DEBUG" ] && set -x
94+
95+ # This is directly taken from the official yq examples and merges all
96+ # listed files
97+ yq eval-all '. as $item ireduce ({}; . * $item )' \
98+ "$CHART_DIRECTORY/values/${CHART_REGISTRY_URI}.yaml" \
99+ "$CHART_DIRECTORY/values.yaml" \
100+ > "$CHART_DIRECTORY/values.merged.yaml"
101+
102+ mv "$CHART_DIRECTORY/values.merged.yaml" "$CHART_DIRECTORY/values.yaml"
103+
78104 - name : Package Helm Chart
79105 env :
80106 CHART_DIRECTORY : ${{ inputs.chart-directory }}
@@ -86,10 +112,6 @@ runs:
86112 set -euo pipefail
87113 [ -n "$GITHUB_DEBUG" ] && set -x
88114
89- # Set the Helm Chart version
90- # yq ".version = \"$CHART_VERSION\"" < "$CHART_DIRECTORY/Chart.yaml" > "$CHART_DIRECTORY/Chart.new.yaml"
91- # mv "$CHART_DIRECTORY/Chart.new.yaml" "$CHART_DIRECTORY/Chart.yaml"
92-
93115 # Create temporary directory to store the Helm Chart
94116 TEMP_CHART_DIR=$(mktemp -d)
95117 echo "TEMP_CHART_DIR=$TEMP_CHART_DIR" | tee -a "$GITHUB_ENV"
0 commit comments