-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into TT-13588/tyk_api_port
- Loading branch information
Showing
2 changed files
with
111 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
name: Helm Charts Release Alpha Version | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+" | ||
|
||
jobs: | ||
prepare-release: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
charts: ${{ steps.find-charts.outputs.charts }} | ||
version: ${{ steps.extract-version.outputs.version }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Extract version | ||
id: extract-version | ||
run: | | ||
VERSION=${GITHUB_REF#refs/tags/v} | ||
echo "version=${VERSION}" >> $GITHUB_OUTPUT | ||
- name: Find charts to release | ||
id: find-charts | ||
run: | | ||
CHARTS=$(find . -type f -name Chart.yaml -not -path "*/components/tyk-operator/*" -exec dirname {} \; | jq -R . | jq -sc .) | ||
echo "charts=${CHARTS}" >> $GITHUB_OUTPUT | ||
- name: Update Chart.yaml of each chart | ||
run: | | ||
for chart_dir in $(find . -type f -name Chart.yaml -not -path "*/components/tyk-operator/*" -exec dirname {} \;); do | ||
chart_file_path="$chart_dir/Chart.yaml" | ||
echo " --> updating: $chart_dir $chart_file_path" | ||
yq eval ' | ||
.version = "${{ steps.extract-version.outputs.version }}" | | ||
.annotations["artifacthub.io/prerelease"] = "true" | ||
' -i $chart_file_path | ||
if [[ "$chart_dir" != "./components"* ]]; then | ||
echo " --> umbrella chart dependencies update $chart_dir $chart_file_path" | ||
num_deps=$(yq eval '.dependencies | length' "${chart_file_path}") | ||
echo " --> umbrella chart dependencies count: $num_deps" | ||
if [ "${num_deps}" -gt 0 ]; then | ||
charts=${{ steps.find-charts.outputs.charts }} | ||
echo "$charts" | ||
for i in $(seq 0 $((num_deps - 1))); do | ||
dep_name=$(yq eval ".dependencies[$i].name" "${chart_file_path}") || continue | ||
echo " --> umbrella chart dependency check: $dep_name" | ||
if [[ "${dep_name}" =~ "tyk" ]] && [ "${dep_name}" != "tyk-operator" ]; then | ||
echo " --> update dependency $dep_name version to ${{ steps.extract-version.outputs.version }}" | ||
yq eval ".dependencies[$i].version = \"${{ steps.extract-version.outputs.version }}\"" -i "${chart_file_path}" | ||
fi | ||
done | ||
fi | ||
fi | ||
echo " --> cat $chart_dir $chart_file_path" | ||
cat $chart_file_path | ||
done | ||
|
||
- name: Upload modified charts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: charts | ||
path: "./**" | ||
|
||
release-alpha-version: | ||
needs: prepare-release | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
chart: ${{ fromJson(needs.prepare-release.outputs.charts) }} | ||
steps: | ||
- name: Download modified charts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: charts | ||
path: "./" | ||
|
||
- name: Set up Helm | ||
uses: azure/setup-helm@v3 | ||
with: | ||
version: "v3.16.0" | ||
|
||
- name: Update Helm Dependencies | ||
run: | | ||
helm repo add tyk-helm https://helm.tyk.io/public/helm/charts/ | ||
helm dependency update ${{ matrix.chart }} | ||
- name: Package Helm Chart | ||
run: | | ||
helm package ${{ matrix.chart }} --version ${{ needs.prepare-release.outputs.version }} | ||
- name: Helm Chart package file name | ||
id: file-name | ||
run: | | ||
echo "fileName=$(basename ${{ matrix.chart }})-${{ needs.prepare-release.outputs.version }}.tgz" | ||
echo "fileName=$(basename ${{ matrix.chart }})-${{ needs.prepare-release.outputs.version }}.tgz" >> "$GITHUB_OUTPUT" | ||
- name: Push Helm Chart to Cloudsmith | ||
uses: cloudsmith-io/[email protected] | ||
with: | ||
api-key: ${{ secrets.CLOUDSMITH_API_KEY }} | ||
command: "push" | ||
format: "helm" | ||
owner: "tyk" | ||
repo: "helm" | ||
file: "${{ steps.file-name.outputs.fileName }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters