Skip to content

Added parameters in Applications to point to external resources (#132) #121

Added parameters in Applications to point to external resources (#132)

Added parameters in Applications to point to external resources (#132) #121

name: Helm Release
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'charts/**'
- '!charts/**/README.md'
env:
HELM_VERSION: "v3.5.3"
jobs:
helm-release:
runs-on: 'ubuntu-latest'
steps:
- name: "Checkout main branch"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Configure Git"
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: "Install Helm"
uses: azure/[email protected]
with:
version: "${{ env.HELM_VERSION }}"
- name: Add Helm repositories
run: |
# Install yq tool to parse Chart.yaml to identify Helm dependencies repositories
wget https://github.com/mikefarah/yq/releases/download/v4.21.1/yq_linux_386 -O /usr/bin/yq && chmod +x /usr/bin/yq
# Retrieve all helm dependencies repositories and run `helm repo add` for each of them.
# Command explanation follows:
#
# yq '.dependencies.[].repository' helm/*/Chart.yaml --> Prints repository field for all Chart dependencies.
# sed 's:/*$::' --> Trims the trailing forward slash '/' at the end of the repository URL, if any
# sort | uniq ----> Removes duplicated entries, for those cases where more than 1 dependency comes
# from the same Helm repository
yq '.dependencies.[].repository' charts/*/Chart.yaml | awk '/^http/' | sed 's:/*$::' | sort | uniq | while read helm_repo; do
# Helm repo name is generated from a random string, as it is not persisted between executions.
helm repo add $(openssl rand -hex 12) ${helm_repo}
done
- name: "Run chart-releaser"
uses: helm/[email protected]
with:
charts_dir: charts
charts_repo_url: https://empathyco.github.io/helm-charts/
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"