Skip to content

[TT-12126] Release to 1.5.0 - Prepare artifacts for 1.5.0 helm releas… #57

[TT-12126] Release to 1.5.0 - Prepare artifacts for 1.5.0 helm releas…

[TT-12126] Release to 1.5.0 - Prepare artifacts for 1.5.0 helm releas… #57

Workflow file for this run

name: Release Helm charts
on:
push:
branches:
- main
paths:
- '**/Chart.yaml'
jobs:
get-list-of-charts:
runs-on: ubuntu-latest
name: 'Get list of charts to be released'
outputs:
charts: ${{ steps.get-charts.outputs.charts }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: get-charts
name: Get list of charts to be released
run: |
# Get list of Chart.yaml files changed in the last commit
files_changed="$(git show --pretty="" --name-only | grep Chart.yaml)"
charts=()
for file in $files_changed; do
count=$(git show "$file" | grep -c "+version" || true)
if [ $count -eq 0 ]; then
echo "No version change in $file"
continue
fi
charts+=("$(echo "$file" | xargs dirname)")
done
if [ ${#charts[@]} -eq 0 ]; then
echo "No charts to be released"
echo "charts=none" >> "$GITHUB_OUTPUT"
else
echo "charts=$(jq 'split(" ")' -Rc <(echo ${charts[@]}))" >> "$GITHUB_OUTPUT"
fi
release-charts:
runs-on: ubuntu-latest
needs: get-list-of-charts
if: needs.get-list-of-charts.outputs.charts != 'none'
strategy:
matrix:
chart: ${{ fromJson(needs.get-list-of-charts.outputs.charts) }}
steps:
- name: Git Checkout
uses: actions/checkout@v3
- name: Setup Helm
uses: azure/setup-helm@v3
with:
version: v3.5.3
- name: Read Helm Chart version
id: chart-version
run: echo "version=$(awk '/^version:/ {print $2}' ${{ matrix.chart }}/Chart.yaml)" >> "$GITHUB_OUTPUT"
- name: Helm Chart package file name
id: file-name
run: |
echo "fileName=$(basename ${{ matrix.chart }})-${{ steps.chart-version.outputs.version }}.tgz"
echo "fileName=$(basename ${{ matrix.chart }})-${{ steps.chart-version.outputs.version }}.tgz" >> "$GITHUB_OUTPUT"
- name: Update dependencies
run: helm dependency update ${{ matrix.chart }}
- name: Package Helm Chart
run: helm package ${{ matrix.chart }} --version ${{ steps.chart-version.outputs.version }}
- name: Push Helm Chart
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 }}"