Skip to content

Merge pull request #410 from klihub/devel/race-detector-in-debug-imag… #109

Merge pull request #410 from klihub/devel/race-detector-in-debug-imag…

Merge pull request #410 from klihub/devel/race-detector-in-debug-imag… #109

Workflow file for this run

name: Package Helm charts
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
branches:
- main
- release-*
env:
CHARTS_DIR: deployment/helm/
UNSTABLE_CHARTS: unstable-helm-charts
REGISTRY: ghcr.io
REGISTRY_USER: ${{ github.repository_owner }}
REGISTRY_PATH: ${{ github.repository }}
jobs:
release:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Helm
uses: azure/[email protected]
- name: Package Stable Helm Charts
run: |
find "$CHARTS_DIR" -name values.yaml | xargs -I '{}' \
sed -e s"/pullPolicy:.*/pullPolicy: IfNotPresent/" -i '{}'
helm package --version "$GITHUB_REF_NAME" --app-version "$GITHUB_REF_NAME" "$CHARTS_DIR"/*
find . -name '*.tgz' -print | while read SRC_FILE; do
DEST_FILE=$(echo $SRC_FILE | sed 's/v/helm-chart-v/g')
mv $SRC_FILE $DEST_FILE
done
- name: Upload Stable Helm Charts to GitHub Release
uses: softprops/action-gh-release@v1
with:
name: ${{ github.ref_name }}
draft: true
append_body: true
files: nri-*helm-chart*.tgz
unstable:
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
concurrency:
group: unstable-helm-charts
cancel-in-progress: false
permissions:
packages: write
runs-on: ubuntu-latest
steps:
- name: Deep Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Helm
uses: azure/[email protected]
- name: Package Unstable Helm Charts
id: package-charts
run: |
# For unstable chart version we use:
# - chart version: x.y-unstable derived from the latest tag x.y.z
# - image version: 'unstable'.
majmin="$(git describe --tags | sed -E 's/(v[0-9]*\.[0-9]*).*$/\1/')"
CHART_VERSION="${majmin}-unstable"
if [ $GITHUB_REF_NAME = "main" ]; then
APP_VERSION=unstable
else
APP_VERSION="${majmin}-unstable"
fi
# Package charts
find "$CHARTS_DIR" -name values.yaml | xargs -I '{}' \
sed -e s"/pullPolicy:.*/pullPolicy: Always/" -i '{}'
helm package --version "$CHART_VERSION" --app-version $APP_VERSION "$CHARTS_DIR"/*
find "$CHARTS_DIR" -name values.yaml | xargs -I '{}' \
git checkout '{}'
mkdir ../$UNSTABLE_CHARTS
find . -name '*.tgz' -print | while read SRC_FILE; do
DEST_FILE=$(echo $SRC_FILE | sed 's/v/helm-chart-v/g')
mv -v $SRC_FILE ../$UNSTABLE_CHARTS/$DEST_FILE
done
- name: Log In To Registry
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | \
helm registry login ${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }} -u ${{ env.REGISTRY_USER }} --password-stdin
- name: Push Unstable Helm Charts To Registry
shell: bash
run: |
# Notes:
# Currently we only publish unstable Helm charts from main/HEAD.
# We have no active cleanup of old unstable charts in place. In
# between new tags unstable chart have the same version, though.
pushd ../$UNSTABLE_CHARTS
for i in ./*.tgz; do
helm push $i oci://${{ env.REGISTRY }}/${{ env.REGISTRY_PATH }}/helm-charts
done
popd