Compare commits

...

10 commits

Author SHA1 Message Date
85b42eee78
fix: replace gitea by forgejo 2025-10-22 03:53:39 +00:00
4c6d456a1c
fix: add orga to K8S_NS generated name 2025-10-04 14:32:49 +00:00
eff7472739
fix: docker server == registry 2025-04-03 11:22:07 +00:00
d1f56fe98d
feat: workdir variable 2024-11-29 05:39:38 +00:00
2b2a1ac12c
remove test 2024-11-29 05:08:06 +00:00
dd103cf3b7
test 2024-11-29 05:05:59 +00:00
c92462e209
fix: namespace name validation 2024-11-29 04:50:52 +00:00
860ab947e4
fix: invalid namespace name 2024-11-29 04:46:13 +00:00
84ec9cf196
feat: export K8S_NS 2024-05-15 19:41:54 +02:00
6bf1ef88a2
feat: remove unused Dockerfile 2024-05-10 12:40:42 +02:00
4 changed files with 15 additions and 27 deletions

View file

@ -1,19 +0,0 @@
FROM debian:12-slim as kubectl
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/*
RUN V="$(curl -sSL https://dl.k8s.io/release/stable.txt)" \
&& curl -Lo /kubectl "https://dl.k8s.io/release/$V/bin/linux/amd64/kubectl"
FROM debian:12-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=kubectl --chmod=0755 /kubectl /usr/local/bin/
COPY k8sdeploy.sh /usr/local/bin/
RUN useradd -m app
USER app
ENTRYPOINT ["k8sdeploy.sh"]

View file

@ -1 +1 @@
# k8sdeploy@v1
# k8sdeploy@v2

View file

@ -4,12 +4,15 @@ inputs:
required: true
registry_username:
description: Registry username
default: ${{ gitea.repository_owner }}
default: ${{ forgejo.repository_owner }}
registry_password:
description: Registry password
workdir:
description: Working directory where to the action from
default: .
runs:
using: composite
steps:
- name: k8sdeploy
run: ${{ gitea.action_path }}/k8sdeploy.sh
run: ${{ forgejo.action_path }}/entrypoint.sh

View file

@ -1,17 +1,21 @@
#!/bin/bash -e
# shellcheck disable=SC1091
cd "$INPUT_WORKDIR"
set -a
# shellcheck disable=SC1091
. ./.env
set +a
REGISTRY="${IMAGEAPP%%/*}"
NS="${GITHUB_REPOSITORY#*/}-${GITHUB_REF_NAME}"
export K8S_NS;
K8S_NS="$(printf '%s' "${GITHUB_REPOSITORY//\//-}-$GITHUB_REF_NAME" \
| tr '[:upper:]' '[:lower:]' | tr -c '[:lower:][:digit:]-' - \
| sed 's/-\+/-/g; s/^-\+//; s/-$//')"
mkdir -p "$HOME/.kube/"
echo "$INPUT_KUBECONFIG" > "$HOME/.kube/config"
kubectl get namespace "$NS" || kubectl create namespace "$NS"
kubectl config set-context --current --namespace="$NS"
kubectl get namespace "$K8S_NS" || kubectl create namespace "$K8S_NS"
kubectl config set-context --current --namespace="$K8S_NS"
if [ -n "$INPUT_REGISTRY_PASSWORD" ]; then
kubectl get secret regcred \