2024-04-30 21:08:27 +00:00
|
|
|
#!/bin/bash -e
|
|
|
|
# shellcheck disable=SC1091
|
|
|
|
|
|
|
|
set -a
|
|
|
|
. ./.env
|
|
|
|
set +a
|
|
|
|
|
|
|
|
REGISTRY="${IMAGEAPP%%/*}"
|
2024-05-02 15:27:39 +00:00
|
|
|
NS="${GITHUB_REPOSITORY#*/}-${GITHUB_REF_NAME}"
|
2024-04-30 21:08:27 +00:00
|
|
|
|
|
|
|
mkdir -p "$HOME/.kube/"
|
2024-05-10 09:59:11 +00:00
|
|
|
echo "$INPUT_KUBECONFIG" > "$HOME/.kube/config"
|
2024-04-30 21:08:27 +00:00
|
|
|
kubectl get namespace "$NS" || kubectl create namespace "$NS"
|
|
|
|
kubectl config set-context --current --namespace="$NS"
|
|
|
|
|
2024-05-10 09:59:11 +00:00
|
|
|
if [ -n "$INPUT_REGISTRY_PASSWORD" ]; then
|
2024-04-30 21:34:03 +00:00
|
|
|
kubectl get secret regcred \
|
|
|
|
|| kubectl create secret docker-registry regcred \
|
|
|
|
--docker-server="$REGISTRY" \
|
2024-05-10 09:59:11 +00:00
|
|
|
--docker-username="$INPUT_REGISTRY_USERNAME" \
|
|
|
|
--docker-password="$INPUT_REGISTRY_PASSWORD"
|
2024-04-30 21:08:27 +00:00
|
|
|
fi
|
|
|
|
|
2024-05-10 09:59:11 +00:00
|
|
|
if [ "$GITHUB_REF_NAME" = prod ] || [ "$GITHUB_REF_NAME" = staging ]; then
|
2024-05-01 10:36:00 +00:00
|
|
|
./manifests/bin/prod.sh
|
|
|
|
else
|
|
|
|
./manifests/bin/devel.sh
|
|
|
|
fi
|