action run testing-36

This commit is contained in:
action-runner
2025-10-24 12:14:54 +00:00
parent c428ee3968
commit 2c7c38993c

74
action.yaml Normal file
View File

@@ -0,0 +1,74 @@
name: "update helm release"
description: "deploy helm release with new image"
inputs:
release_name:
required: true
image_paths:
required: false
default: "image.tag" # NOTE space separated
namespace:
required: false
default: ""
image_tag:
required: false
default: ""
repository_location:
required: false
default: "europe-docker.pkg.dev/puzzle-and-play/helm"
timeout:
required: false
default: "5m"
runs:
using: composite
steps:
- shell: bash
env:
RELEASE_NAME: "${{ inputs.release_name }}"
NAMESPACE: "${{ inputs.namespace }}"
REPOSITORY_LOCATION: "${{ inputs.repository_location }}"
HELM_CHARTS_DIR: "$HOME/.cache/helm/charts"
IMAGE_PATHS: "${{ inputs.image_paths }}"
IMAGE_TAG: "${{ inputs.image_tag }}"
HELM_UPGRADE_TIMEOUT: "${{ inputs.timeout }}"
run: |
: ${NAMESPACE:="$RELEASE_NAME"}
: ${IMAGE_TAG:="${{ github.ref_name }}-${{ github.run_number }}"}
history=$(\
helm history $RELEASE_NAME -n $NAMESPACE --max 1 -o json \
| jq ".[].chart | split(\"-\")" \
)
chart_name=$(echo $history | jq ".[0]" -r)
chart_version=$(echo $history | jq ".[1]" -r)
HELM_CHARTS_DIR=$(echo "$HELM_CHARTS_DIR" | envsubst)
mkdir -p "$HELM_CHARTS_DIR"
helm pull \
"oci://$REPOSITORY_LOCATION/$chart_name" \
--version "$chart_version" \
-d "$HELM_CHARTS_DIR"
chart_filename="${HELM_CHARTS_DIR}/${chart_name}-${chart_version}.tgz"
value_overrides=$(\
echo "\"$IMAGE_PATHS\"" \
| jq -r '. | split(" ") | map(. + "=$IMAGE_TAG") | join(",")' \
| envsubst \
)
helm upgrade \
"$RELEASE_NAME" \
"$chart_filename" \
--version "$chart_version" \
--namespace "$NAMESPACE" \
--reuse-values \
--set "$value_overrides" \
--timeout "$HELM_UPGRADE_TIMEOUT"