-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
55 lines (47 loc) · 1.49 KB
/
build.sh
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
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
charts="/tmp/charts"
tmp_charts="/tmp/tmp_charts"
if [[ -d $tmp_charts ]]
then
rm -rf $tmp_charts
fi
if [[ -d $charts ]]
then
rm -rf $charts
fi
mkdir $tmp_charts -p
git clone https://github.com/little-angry-clouds/charts $charts
cd little-angry-clouds
for file in $charts/*
do
if [[ -d $file ]]
then
helm package -u -d $tmp_charts $file
fi
done
# Update repository
cd -
helm repo index --url "https://little-angry-clouds.github.io/" --merge index.yaml $tmp_charts/
mv $tmp_charts/index.yaml .
check_if_index_staged="$(git diff --unified=0 index.yaml | grep -v "digest\|created\|generated\|diff\|index\|---\|---\|@@")"
if [[ -n $check_if_index_staged ]]
then
echo "Update repository"
mv $tmp_charts/*.tgz little-angry-clouds
git add index.yaml little-angry-clouds
# Nasty HACK
sed -i "s/little-angry-clouds.github.io\/haproxy-network-ingress/little-angry-clouds.github.io\/little-angry-clouds\/haproxy-network-ingress/g" index.yaml
sed -i "s/little-angry-clouds.github.io\/alertmanager-actions/little-angry-clouds.github.io\/little-angry-clouds\/alertmanager-actions/g" index.yaml
git commit -m "[ci] Update or add new pacakges"
else
git checkout index.yaml
fi
# Update index
grep -v "^# Little" $charts/README.md > index.md
check_if_readme_staged=$(git status --porcelain index.md index.yaml)
if [[ -n "$check_if_readme_staged" ]]
then
echo "Update README"
git add index.md index.yaml
git commit -m "[ci] Update README"
fi