File tree Expand file tree Collapse file tree 2 files changed +55
-0
lines changed
Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Original file line number Diff line number Diff line change 1+ name : update-charts
2+ on :
3+ push :
4+ branches :
5+ - ' master'
6+ env :
7+ REGISTRY : ghcr.io
8+ REPO : " ${{ github.repository }}"
9+ jobs :
10+ build :
11+ runs-on : ubuntu-latest
12+ permissions :
13+ contents : read
14+ packages : write
15+ steps :
16+ - name : Checkout
17+ uses : actions/checkout@v3
18+ - name : prepare utilities
19+ run : |
20+ wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/local/bin/yq && chmod +x /usr/local/bin/yq
21+ curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
22+ - name : registry login
23+ run : |
24+ helm registry login --username ${{github.actor}} --password ${{secrets.GITHUB_TOKEN}} "$REGISTRY"
25+ - name : update all
26+ run : |
27+ cd charts
28+ ./update.sh "$REGISTRY/$REPO"
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+
4+ function pack-push-remove {
5+ local REGISTRY=" $1 "
6+ local CHART_NAME=" $( yq ' .name' Chart.yaml -r) "
7+ local CHART_VER=" $( yq ' .version' Chart.yaml -r) "
8+ if helm pull " oci://$REGISTRY /$CHART_NAME " --version " $CHART_VER " 2> /dev/null; then
9+ echo " Chart $CHART_NAME with version $CHART_VER exist. Skip"
10+ rm " $CHART_NAME -$CHART_VER .tgz"
11+ return 0
12+ fi
13+ helm package .
14+ helm push " $CHART_NAME -$CHART_VER .tgz" " oci://$REGISTRY "
15+ rm " $CHART_NAME -$CHART_VER .tgz"
16+ }
17+
18+ function update-all {
19+ local REGISTRY=" $1 "
20+ find -mindepth 1 -maxdepth 1 -type d ! -name ' _*' | while read DIR; do
21+ pushd " $DIR "
22+ pack-push-remove " $REGISTRY "
23+ popd
24+ done
25+ }
26+
27+ update-all " $1 "
You can’t perform that action at this time.
0 commit comments