forked from secureCodeBox/secureCodeBox
-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (45 loc) · 1.79 KB
/
helm-charts-release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# SPDX-FileCopyrightText: the secureCodeBox authors
#
# SPDX-License-Identifier: Apache-2.0
on:
release:
types: [published]
name: "Publish Helm Charts"
jobs:
helm:
name: Package and Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Install yq"
run: |
sudo snap install yq
- name: "Publish Helm Charts"
env:
HELM_REGISTRY: https://charts.securecodebox.io
USERNAME: ${{ secrets.HELM_REGISTRY_USERNAME }}
PASSWORD: ${{ secrets.HELM_REGISTRY_PASSWORD }}
run: |
RELEASE_VERSION="${GITHUB_REF#refs/*/}"
# Remove leading 'v' from git tag to create valid semver
RELEASE_VERSION="${RELEASE_VERSION//v}"
# Publish all helm charts in all folders containing a `Chart.yaml` file
# https://github.com/koalaman/shellcheck/wiki/SC2044
find . -type f -name Chart.yaml -not -path "./.templates/*" -print0 | while IFS= read -r -d '' chart; do
(
dir="$(dirname "${chart}")"
cd "${dir}" || exit
echo "Processing Helm Chart in $dir"
NAME=$(yq eval '.name' - < Chart.yaml)
if [ -d "docs" ]; then
echo "Docs Folder found at: ${dir}/docs"
# Use prepared ArtifactHub specific README instead of the general existing one
cp docs/README.ArtifactHub.md README.md
else
echo "Ignoring Docs process for Chart $dir, because no `docs` folder found at: ${dir}/docs"
fi
helm package --version $RELEASE_VERSION .
curl --silent --show-error --http1.1 --user "${USERNAME}:${PASSWORD}" --data-binary "@${NAME}-${RELEASE_VERSION}.tgz" "${HELM_REGISTRY}/api/charts"
sleep 5s
)
done