feat: k8sdeploy
This commit is contained in:
commit
ea50afcd5c
20
action.yaml
Normal file
20
action.yaml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
inputs:
|
||||||
|
kubeconfig:
|
||||||
|
description: kubeconfig file
|
||||||
|
required: true
|
||||||
|
registry_username:
|
||||||
|
description: Registry username
|
||||||
|
default: ${{ gitea.repository_owner }}
|
||||||
|
registry_password:
|
||||||
|
description: Registry password
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: k8sdeploy
|
||||||
|
run: ${{ gitea.action_path }}/k8sdeploy.sh
|
||||||
|
env:
|
||||||
|
ACTION_REPO: ${{ gitea.repository }}
|
||||||
|
ACTION_KUBECONFIG: ${{ inputs.kubeconfig }}
|
||||||
|
ACTION_REGISTRY_USERNAME: ${{ inputs.registry_username }}
|
||||||
|
ACTION_REGISTRY_PASSWORD: ${{ inputs.registry_password }}
|
23
k8sdeploy.sh
Executable file
23
k8sdeploy.sh
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
# shellcheck disable=SC1091
|
||||||
|
|
||||||
|
set -a
|
||||||
|
. ./.env
|
||||||
|
set +a
|
||||||
|
|
||||||
|
REGISTRY="${IMAGEAPP%%/*}"
|
||||||
|
NS="${ACTION_REPO#*/}"
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
|
if [ -n "$ACTION_REGISTRY_PASSWD" ]; then
|
||||||
|
kubectl create secret docker-registry regcred \
|
||||||
|
--docker-server="$REGISTRY" \
|
||||||
|
--docker-username="$ACTION_REGISTRY_USER" \
|
||||||
|
--docker-password="$ACTION_REGISTRY_PASSWD"
|
||||||
|
fi
|
||||||
|
|
||||||
|
./manifests/bin/devel.sh
|
Loading…
Reference in New Issue
Block a user