Skip to content

fix(helm): typo

fix(helm): typo #112

name: Release Charts
on:
push:
branches:
- master
paths:
- charts/**
- .github/workflows/release-charts.yaml
workflow_dispatch:
jobs:
release:
permissions:
contents: write
env:
CHART_DIR: charts
CHART_REPO: isac322/helm-charts
CHART_REPO_BRANCH: master
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout Helm chart repo
uses: actions/checkout@v4
with:
repository: ${{ env.CHART_REPO }}
path: .helm-chart-repo
token: ${{ secrets.CHART_GITHUB_TOKEN }}
- name: Install yq - portable yaml processor
uses: mikefarah/yq@v4
- name: Collect charts
id: charts
# language=Bash
run: |
set -e
find -L charts -mindepth 2 -maxdepth 2 -type f \( -name 'Chart.yaml' -o -name 'Chart.yml' \) -exec dirname "{}" \; \
| sort -u \
| sed -E 's/^/- /' \
| yq --no-colors --indent 0 --output-format json '.' \
| sed -E 's/^/charts=/' >> $GITHUB_OUTPUT
- name: Install chart releaser
# language=Bash
run: |
set -e
arch="$(dpkg --print-architecture)"
curl -s https://api.github.com/repos/helm/chart-releaser/releases/latest \
| yq --indent 0 --no-colors --input-format json --unwrapScalar \
".assets[] | select(.name | test("\""^chart-releaser_.+_linux_${arch}\.tar\.gz$"\"")) | .browser_download_url" \
| xargs curl -SsL \
| tar zxf - -C /usr/local/bin
- name: Install Helm
uses: azure/[email protected]
- name: Helm Deps
# language=Bash
run: |
set -ex
echo '${{ steps.charts.outputs.charts }}' \
| yq --indent 0 --no-colors --input-format json --unwrapScalar '.[]' \
| while read -r dir; do
helm dependency update $dir;
if [ -f "$dir/Chart.lock" ]; then
yq --indent 0 \
'.dependencies | map(["helm", "repo", "add", .name, .repository] | join(" ")) | .[]' \
"$dir/Chart.lock" \
| sh --;
fi
done
- name: Package charts
id: package
# language=Bash
run: |
set -ex
PACKAGES=.cr-release-packages
echo '${{ steps.charts.outputs.charts }}' \
| yq --indent 0 --no-colors --input-format json --unwrapScalar '.[]' \
| xargs -d$'\n' cr package --package-path "$PACKAGES"
echo "dir=${PACKAGES}" >> $GITHUB_OUTPUT
- name: Upload packages
# language=Bash
run: |
set -ex
git config --list
owner=$(cut -d '/' -f 1 <<< '${{ github.repository }}')
repo=$(cut -d '/' -f 2 <<< '${{ github.repository }}')
cr upload --commit '${{ github.sha }}' --git-repo "$repo" --owner "$owner" --token '${{ github.token }}' \
--package-path '${{ steps.package.outputs.dir }}' --skip-existing
- name: Update charts index
working-directory: .helm-chart-repo
# language=Bash
run: |
set -ex
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
mkdir -p .cr-index
owner=$(cut -d '/' -f 1 <<< '${{ github.repository }}')
repo=$(cut -d '/' -f 2 <<< '${{ github.repository }}')
cr index --git-repo "$repo" --owner "$owner" --pages-branch '${{ env.CHART_REPO_BRANCH }}' \
--package-path '../${{ steps.package.outputs.dir }}' \
--index-path .cr-index --push