Merge pull request #61 from empathyco/chore/rollouts #56
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: CI - Helm Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- 'charts/**' | |
- '!charts/**/README.md' | |
jobs: | |
helm-release: | |
runs-on: 'ubuntu-latest' | |
defaults: | |
run: | |
shell: sh | |
steps: | |
- name: "Checkout main branch" | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: "Configure Git" | |
shell: sh | |
run: | | |
git config --global user.name "$GITHUB_ACTOR" | |
git config --global user.email "[email protected]" | |
- name: "Install Helm" | |
uses: azure/setup-helm@v4 | |
with: | |
version: v3.7.0 | |
- 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 | |
env: | |
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |