77
88
99jobs :
10- release :
10+ release-core :
1111 runs-on : ubuntu-latest
1212 permissions :
1313 contents : write
@@ -26,21 +26,73 @@ jobs:
2626 - name : Helm tool installer
2727 uses : azure/setup-helm@v1
2828 with :
29- version : ' 3.5.4' # default is latest stable
29+ version : ' 3.5.4'
3030 id : install
3131
32- # - name: Parse Chart.yaml
33- # id: parse-chart
34- # run: |
35- # name=$(yq ".name" < Chart.yaml)
36- # version=$(yq ".version" < Chart.yaml)
37- # echo "::set-output name=tagname::${name}-${version}"
32+ - name : Add dependency chart repos
33+ run : |
34+ helm repo add ecovadis https://ecovadiscode.github.io/charts/
35+
36+ - name : Remove all charts except core
37+ run : |
38+ find charts/ -mindepth 1 -maxdepth 1 -type d ! -name core -exec rm -rf {} +
39+
40+ - name : Run chart-releaser for core
41+ uses : helm/chart-releaser-action@v1.4.0
42+ with :
43+ charts_dir : " charts"
44+ env :
45+ CR_TOKEN : " ${{ secrets.GITHUB_TOKEN }}"
46+
47+ release-remaining :
48+ needs : release-core
49+ runs-on : ubuntu-latest
50+ permissions :
51+ contents : write
52+ steps :
53+ - name : Checkout
54+ uses : actions/checkout@v2
55+ with :
56+ fetch-depth : 0
57+ ref : master
58+
59+ - name : Configure Git
60+ run : |
61+ git config user.name "$GITHUB_ACTOR"
62+ git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
63+
64+ - name : Helm tool installer
65+ uses : azure/setup-helm@v1
66+ with :
67+ version : ' 3.5.4'
68+ id : install
3869
3970 - name : Add dependency chart repos
4071 run : |
4172 helm repo add ecovadis https://ecovadiscode.github.io/charts/
4273
43- - name : Run chart-releaser
74+ - name : Wait for core chart availability in Helm repo
75+ run : |
76+ # Find the highest core version required by any dependent chart
77+ NEEDED_VERSION=$(grep -A1 'name: charts-core' charts/*/Chart.yaml | grep 'version:' | sed 's/.*version:[[:space:]]*//' | tr -d '"' | sort -V | tail -1)
78+ if [ -z "$NEEDED_VERSION" ]; then
79+ echo "No charts depend on charts-core, skipping wait."
80+ exit 0
81+ fi
82+ echo "Highest charts-core version needed by dependent charts: ${NEEDED_VERSION}"
83+ for i in $(seq 1 30); do
84+ helm repo update 2>/dev/null
85+ if helm search repo ecovadis/charts-core --version "${NEEDED_VERSION}" | grep -q "${NEEDED_VERSION}"; then
86+ echo "charts-core ${NEEDED_VERSION} is available!"
87+ exit 0
88+ fi
89+ echo "Attempt ${i}/30 - not yet available, waiting 10s..."
90+ sleep 10
91+ done
92+ echo "Timeout waiting for charts-core ${NEEDED_VERSION} after 5 minutes"
93+ exit 1
94+
95+ - name : Run chart-releaser for remaining charts
4496 uses : helm/chart-releaser-action@v1.4.0
4597 with :
4698 charts_dir : " charts"
0 commit comments