Skip to content

Feat/docs

Feat/docs #22

Workflow file for this run

name: Helm publish
on:
workflow_call:
outputs:
helm_repo_url:
description: "Helm repo URL"
value: ${{ jobs.helm-publish.outputs.helm_repo_url }}
helm_chart:
description: "Helm Chart"
value: ${{ jobs.helm-publish.outputs.helm_chart }}
helm_target_revision:
description: "Helm target revision"
value: ${{ jobs.helm-publish.outputs.helm_target_revision }}
pull_request:
permissions:
packages: write
jobs:
helm-publish:
name: Publish Helm
runs-on: ubuntu-latest
outputs:
helm_repo_url: ${{ steps.push.outputs.helm_repo_url }}
helm_chart: ${{ steps.push.outputs.helm_chart }}
helm_target_revision: ${{ steps.push.outputs.helm_target_revision }}
steps:
- uses: actions/checkout@v4
- name: Prepare
id: prep
uses: ./.github/actions/prep
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🐳 Helm dependency
run: |
yq --indent 0 '.dependencies | map(select(.repository | test("^oci:") | not)) | map(["helm", "repo", "add", .name, .repository] | join(" ")) | .[]' ./helm/Chart.lock | sh --
helm dependency build ./helm/
- name: Helm lint
run: helm lint ./helm --values ./helm/linter_values.yaml
- name: Helm template
run: |
helm template ./helm --values ./helm/linter_values.yaml
# Test using all test values
for values_file in ./helm/tests/values-*.yaml; do
helm template ./helm --values "$values_file"
done
- name: Package Helm Chart
run: helm package ./helm/ -d ./helm/.helm-charts
- name: Push Helm Chart
id: push
if: github.event_name != 'pull_request'
env:
OCI_REPO: ${{ steps.prep.outputs.helm_oci_repo }}
HELM_TARGET_REVISION: "${{ steps.prep.outputs.helm_target_revision }}"
HELM_CHART: "${{ steps.prep.outputs.helm_chart }}"
run: |
PACKAGE_FILE=$(ls ./helm/.helm-charts/*.tgz | head -n 1)
echo "# Helm Chart" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```yaml' >> $GITHUB_STEP_SUMMARY
helm push "$PACKAGE_FILE" $OCI_REPO 2>> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "> [!Important]" >> $GITHUB_STEP_SUMMARY
echo "> Helm Repo URL: **$OCI_REPO**" >> $GITHUB_STEP_SUMMARY
echo "> Helm Chart: **$HELM_CHART**" >> $GITHUB_STEP_SUMMARY
echo "> Helm Target Revision: **$HELM_TARGET_REVISION**" >> $GITHUB_STEP_SUMMARY
# Add annotations as well (This is shown in reverse order)
echo "::notice::Helm Target Revision: $HELM_TARGET_REVISION"
echo "::notice::Helm Chart: $HELM_CHART"
echo "::notice::Helm Repo URL: $OCI_REPO"
# Add outputs as well (This is shown in reverse order)
echo "helm_target_revision=$HELM_TARGET_REVISION" >> $GITHUB_OUTPUT
echo "helm_chart=$HELM_CHART" >> $GITHUB_OUTPUT
echo "helm_repo_url=$OCI_REPO" >> $GITHUB_OUTPUT