Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit e65c213

Browse files
committed
Use bash magic to publish charts in all folders with a Chart.yaml
1 parent a001c6d commit e65c213

File tree

1 file changed

+10
-36
lines changed

1 file changed

+10
-36
lines changed

.github/workflows/helm-charts.yaml

Lines changed: 10 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -19,42 +19,16 @@ jobs:
1919
USERNAME: ${{ secrets.HELM_REGISTRY_USERNAME }}
2020
PASSWORD: ${{ secrets.HELM_REGISTRY_PASSWORD }}
2121
run: |
22-
package_publish () {
23-
echo "Linting Helm Chart"
22+
# Publish charts in all folders containing a `Chart.yaml` file
23+
# https://github.com/koalaman/shellcheck/wiki/SC2044
24+
find . -type f -name Chart.yaml -print0 | while IFS= read -r -d '' chart; do
25+
(
26+
dir="$(dirname "${chart}")"
27+
cd "${dir}" || exit
28+
echo "Processing Chart in $dir"
2429
helm lint .
25-
echo "Packaging Helm Chart"
2630
helm package --version $RELEASE_VERSION .
27-
echo "Publising Helm Chart"
28-
curl --data-binary "@$(cat Chart.yaml | yq read - name)-${RELEASE_VERSION}.tgz" "${HELM_REGISTRY}/api/charts"
29-
}
30-
31-
# Publishing
32-
33-
# Operator
34-
cd operator
35-
package_publish
36-
cd -
37-
38-
# Scanner
39-
for dir in scanners/*/
40-
do
41-
cd $dir
42-
echo "Processing Chart in: $dir"
43-
if [ -f Chart.yaml ]; then
44-
package_publish
45-
fi
46-
# cd back
47-
cd -
48-
done
49-
50-
# Hooks
51-
for dir in hooks/*/
52-
do
53-
cd $dir
54-
echo "Processing Chart in: $dir"
55-
if [ -f Chart.yaml ]; then
56-
package_publish
57-
fi
58-
# cd back
59-
cd -
31+
NAME=$(yq read - name < Chart.yaml)
32+
curl --silent --show-error --user "${USERNAME}:${PASSWORD}" --data-binary "@${NAME}-${RELEASE_VERSION}.tgz" "${HELM_REGISTRY}/api/charts"
33+
)
6034
done

0 commit comments

Comments
 (0)