k8sdeploy/k8sdeploy.sh

25 lines
654 B
Bash
Raw Normal View History

2024-04-30 21:08:27 +00:00
#!/bin/bash -e
# shellcheck disable=SC1091
set -a
. ./.env
set +a
REGISTRY="${IMAGEAPP%%/*}"
2024-04-30 21:36:16 +00:00
NS="${ACTION_REPO#*/}-${ACTION_REF_NAME}"
2024-04-30 21:08:27 +00:00
mkdir -p "$HOME/.kube/"
echo "$ACTION_KUBECONFIG" > "$HOME/.kube/config"
kubectl get namespace "$NS" || kubectl create namespace "$NS"
kubectl config set-context --current --namespace="$NS"
2024-04-30 21:18:19 +00:00
if [ -n "$ACTION_REGISTRY_PASSWORD" ]; then
2024-04-30 21:34:03 +00:00
kubectl get secret regcred \
|| kubectl create secret docker-registry regcred \
--docker-server="$REGISTRY" \
--docker-username="$ACTION_REGISTRY_USERNAME" \
--docker-password="$ACTION_REGISTRY_PASSWORD"
2024-04-30 21:08:27 +00:00
fi
./manifests/bin/devel.sh