Release Charts #21
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
name: Release Charts | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'helm/featurehub/**' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure Git | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
- name: Install Helm | |
uses: azure/setup-helm@v3 | |
- 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 | |
apt-get update && apt-get install yq | |
# Retrieve all helm dependencies repositories and run `helm repo add` for each of them. | |
# Command explanation follows: | |
# | |
# yq '.dependencies.[].repository' 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' helm/featurehub/Chart.yaml | 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/chart-releaser-action@v1.6.0 | |
with: | |
skip_existing: true | |
charts_dir: helm | |
env: | |
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |