Skip to content

Commit 6c2f5b6

Browse files
committed
feat(helm/release-chart): allows to define which yaml path(s) where to update tags value
Signed-off-by: Emilien Escalle <[email protected]>
1 parent 3508094 commit 6c2f5b6

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

actions/helm/release-chart/action.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ inputs:
5454
tag:
5555
description: "The release tag to set to chart"
5656
required: true
57+
update-tag-paths:
58+
description: |
59+
List of yaml paths to update with the tag.
60+
Comma separated list of paths.
61+
required: false
62+
default: ".version,.appVersion"
5763

5864
outputs:
5965
image:
@@ -84,6 +90,8 @@ runs:
8490
throw new Error(`"tag" input is missing`);
8591
}
8692
93+
const updateTagPaths = `${{ inputs.update-tag-paths }}`.trim().split(',').map(p => p.trim()).filter(p => p);
94+
8795
// Chart.yml files
8896
const globber = await glob.create(`${basePath}/**/Chart.yaml`, {followSymbolicLinks: false})
8997
for await (const chartFile of globber.globGenerator()) {
@@ -98,12 +106,15 @@ runs:
98106
yqUpdates[filePath].push(`.name = "${{ github.event.repository.name }}"`);
99107
100108
// Update dependencies version where repository starts with file://
101-
yqUpdates[filePath].push(`(.dependencies[] | select(.repository == "file://*")).version = "${tag}"`);
109+
if(updateTagPaths.includes('.version')) {
110+
yqUpdates[filePath].push(`(.dependencies[] | select(.repository == "file://*")).version = "${tag}"`);
111+
}
102112
}
103113
104-
// Update version fields
105-
yqUpdates[filePath].push(`.version = "${tag}"`);
106-
yqUpdates[filePath].push(`.appVersion = "${tag}"`);
114+
// Update tag fields
115+
for (const path of updateTagPaths) {
116+
yqUpdates[filePath].push(`${path} = "${tag}"`);
117+
}
107118
}
108119
109120
// values.yml files

0 commit comments

Comments
 (0)