Skip to content

Operator v1.0.0 release #70

Operator v1.0.0 release

Operator v1.0.0 release #70

Workflow file for this run

name: Release Helm charts
on:
pull_request:
branches:
- main
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
shell: bash
run: |
set -e
set -x
# Get list of Chart.yaml files changed in the last commit
files_changed=$(git diff --name-only origin/main...HEAD -- '*/Chart.yaml' || true)
echo "Files changed: $files_changed"
charts=()
for file in $files_changed; do
charts+=("$(dirname "$file")")
done
echo "Charts array: ${charts[@]}"
if [ ${#charts[@]} -eq 0 ]; then
echo "No charts to be released"
echo "charts=none" >> "$GITHUB_OUTPUT"
else
charts_json=$(printf 'components/tyk-operator\n' | jq -R . | jq -s .)
echo "charts=$charts_json" >> "$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 }}"