Files
ermnvldmr.com/ci/scripts/deploy-gitops.sh
T
deytenit c8beec4d47 chore(gitops): clean up kustomization formatting and set-image syntax (#48)
Clean up Kustomize formatting in docs application and set-image syntax
in deploy-gitops.sh
2026-08-23 19:31:25 +03:00

36 lines
972 B
Bash
Executable File

#!/bin/bash
set -euo pipefail
SERVICE=$1
TAG=$2
if [ -z "$SERVICE" ] || [ -z "$TAG" ]; then
echo "Usage: $0 <service: www|docs|umami> <tag>"
exit 1
fi
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
APP_DIR="$ROOT_DIR/ci/k8s/apps/$SERVICE"
if [ ! -d "$APP_DIR" ]; then
echo "Error: Application directory '$APP_DIR' does not exist."
exit 1
fi
echo "Updating Kustomize image tag for '$SERVICE' to '$TAG'..."
cd "$APP_DIR"
kustomize edit set image "ghcr.io/deytenit/ermnvldmr.com/${SERVICE}:${TAG}"
cd "$ROOT_DIR"
git config user.name "adam-at-deytenit"
git config user.email "221188529+adam-at-deytenit@users.noreply.github.com"
git add "ci/k8s/apps/${SERVICE}/kustomization.yaml"
if git diff --staged --quiet; then
echo "No manifest changes to commit for $SERVICE."
else
git commit -m "chore(release): deploy ${SERVICE} ${TAG} [skip ci]"
git push origin next
echo "Successfully deployed $SERVICE ($TAG) via GitOps."
fi