infra/.forgejo/workflows/k8s-diff-and-deploy.yaml

38 lines
1.1 KiB
YAML
Raw Normal View History

2024-10-30 06:16:00 +00:00
on:
push:
paths:
- k8s/**
- .forgejo/workflows/k8s-diff-and-deploy.yaml
jobs:
diff-and-deploy:
runs-on: ubuntu-latest
container:
2024-10-30 06:42:29 +00:00
image: git.janky.solutions/jankysolutions/infra/deployer:latest
2024-10-30 06:16:00 +00:00
steps:
- uses: actions/checkout@v4
- name: kubectl diff and deploy
run: |
set -euo pipefail
echo "${{ secrets.KUBERNETES_CLIENT_CONFIG }}" > ~/.kube/config
for component in k8s/*; do
if [ ! -d "${component}" ]; then
continue
fi
touch "${component}/secrets.yaml"
echo "👀 $ kubectl diff -k ${component}"
kubectl diff -k "${component}" || echo
2024-10-30 06:46:54 +00:00
if [[ "${GITHUB_REF_NAME}" == "main" ]]; then
echo "🚀 $ kubectl apply -k ${component}"
if [[ "${component}" == "k8s/operators" ]]; then
kubectl apply -k "${component}" --server-side
else
kubectl apply -k "${component}"
fi
echo
fi
2024-10-30 06:16:00 +00:00
done